Author Topic: GetData with RecordChan  (Read 3880 times)

juLian

  • Guest
GetData with RecordChan
« on: 8 Jun '03 - 16:23 »
I found a Sub in a sample code included in version 1.4 (lost in my computer), called DrawScope2 and wanted to use to visualize midi or cd, so I tried

BASS_ChannelGetData RECORDCHAN, Sample1(0), 2000
instead
BASS_ChannelGetData STRM, Sample(0), 2000


sample and sample1 should be same, or not? The results are totally different.

Only STRM works well and produce wonderful graphics. So what is the difference between the 2 channels, and how to get similar results?

Thank you for your help. Best regards,

juLian

Ian @ un4seen

  • Administrator
  • Posts: 26222
Re: GetData with RecordChan
« Reply #1 on: 10 Jun '03 - 11:03 »
Does the precompiled LIVESPEC example respond to the sound you're trying to visualise? If not, make sure you've got the appropriate recording input enabled (using the BASS_RecordSetInput function, or manually, using the Windows mixer).

Also make sure you're recording in the same sample format (ie. same number of bits and channels) as your vis code is expecting.

juLian

  • Posts: 2
Re: GetData with RecordChan
« Reply #2 on: 10 Jun '03 - 19:15 »
Thank you, Ian, for your kind answer, but I need a little more help, please.

All your sample code run perfect, also "livespec". I always work with "What you hear" channel, so I get a good visulization (also with recordchan for livespec program).

My problem is with the next code (VB):

BASS_ChannelGetData STRM, Sample(0), 2000

vh = Picture1.ScaleHeight

'left channel

For i = 0 To 500 Step 2
   H = ((Sample(i) + 32768) / 65535 * vh)
   X = (Picture1.ScaleWidth * i) / 500
   If i = 0 Then Picture1.PSet (0, H)
   Picture1.Line -(X, H), QBColor(10)
Next i

(Similar for right channel)

This produce 2 dancing lines in the screen, very nice!!
But I want to get them from the "What you hear" channel, so I changed "STRM" for "RECORDCHAN" (all the rest remain unchanged). and I only see a "erratic" visualization.

What I should do to get the same result that with stream?
Or with other words, Shouldn't I expect the same result with "strm" or "recordchan"?

Thank you for your time and help. Best Regards,

juLian

P.S. I recommend the above code to everybody. I don't know the reason to remove it from the samples (at least, I did not see in the last version).

Ian @ un4seen

  • Administrator
  • Posts: 26222
Re: GetData with RecordChan
« Reply #3 on: 11 Jun '03 - 10:33 »
Quote
But I want to get them from the "What you hear" channel, so I changed "STRM" for "RECORDCHAN" (all the rest remain unchanged). and I only see a "erratic" visualization.

What parameters are you using in your BASS_RecordStart call?

It sounds like you're not using a recording callback function. For your purposes (and most other purposes :)), the callback system is what you want to use. The callback function doesn't have to do anything, other than return TRUE to continue recording. You can see an example in the LIVESPEC source.

juLian

  • Posts: 2
Re: GetData with RecordChan
« Reply #4 on: 11 Jun '03 - 22:09 »
Wow, I got it! :laugh:

I checked the Bass_Recorstart call and I had BASS_SAMPLE_8BITS. That was my error. I changed the flag to 0 (16 bits, stereo) and now I can see midi's, cda, etc through the record channel. Thank you for your help and your time.

Best regards,

juLian