0
0

I’ve been playing with the Record API’s and they work nicely :D.
But how do I save the sample data to a wav file on the hard disk?

Is there an API or do I have to do something else? Oh, and another thing
When I play back the sample (using FSOUND_PlaySound) and try to stop it with FSOUND_StopSound it won’t stop. I’m passing the channel pointer
that was retured with FSOUND_PlaySound, but I can’t get it to work.
any suggestions.

Thanks.

  • You must to post comments
0
0

OK, I know what’s wrong, but I don’t know how to fix it.

I assume your saving function loads an MP3 and saves it as a Wav, right?
I had to make some modifications to write my recoreded data. What is happening is that it won’t reach the end of the sub where it writes
the end of the header. So during the debug mode I moved the yellow
cursor to where it writes the end of the header and it worked fine.

While m_position < m_sampleLen

‘ m_sampleLen is much greater than m_position and it never ends the loop,
but that was after I added “On error resume next” otherwise it says
“Subscript out of range”

Hmm.

  • You must to post comments
0
0

Okay, I fixed it.

Instead of using FSOUND_Sample_Load
I used m_Sample = lngRecSample and multiplied the length x 2
(instead of 4) to get the bytes and now it works.

Thank you very much for your help.
I really appriciate it.

Thanks

  • You must to post comments
0
0

OK, I don’t uderstand the Lock and Unlock functions, could you explain
these, or give me an example?

Thanks

  • You must to post comments
0
0

OK, I really don’t understand, FSOUND_Sample_Lock returns a pointer
to the raw data right? So how do I write the raw data to the disk?
Do I use binary? If so, what to I put in the file?
I use Visual Basic but I can read C++.

Thank you for your time.

  • You must to post comments
0
0

Open your file in binary mode ( Open “out.wav” For Binary Lock Read Write As #1), Write the Wav header (RIFF + Format + Data), Lock the data and write the buffer data to the file ( Put #1, , pcmData), UnLock.

  • You must to post comments
0
0

Ok, sorta getting the idea

Put #1, , “RIFF + Format + Data” ‘Is this the header?

Now, where is the pcmData

FSOUND_Sample_Lock(lngRecSample,0, lngLength, lngPtr1, NULL, lngLen1, 0)

is it lngPtr1 ?

Thanks

  • You must to post comments
0
0

Yes but the second param of SOUND_Sample_Lock must be the loop counter (represent how much data we wrote), ie :

pos = 0
while pos <= sample_len
FSOUND_Sample_Lock(lngRecSample, pos, lngLength, VarPtr(lngPtr1), VarPtr(lngPtr2), VarPtr(lngLen1), VarPtr(lngLen2))
pos = pos + lngLen1
FSOUND_Sample_Unlock(lngRecSample, VarPtr(ptr1), VarPtr(ptr2), VarPtr(lngLen1), VarPtr(lngLen2));
wend

I ll see this afternoon if i can test this code in VB :)

  • You must to post comments
0
0

So, each time it loops, I have to write the data in the file
before it unlocks and clears the buffer. right? and the Offset
is where we start the data again to be written?

Wait a minute! is lngLength suppost to be the Sample length or
just how much data you want to store in the buffer?

EDIT: Is the wave file suppost to be 100,000 some MB in size?!
I don’t think so ๐Ÿ˜•

If you test it in VB and it works, could you post the code.
(I know this isn’t the place for it, so you can post it in
the Visual Basic section if you want to)

Thanks

  • You must to post comments
0
0
  • You must to post comments
0
0

Hey, Thanks, works good. One problem though, Visual Basic crashes
when FMOD tries to play the file. Winamp will play it fine. But what’s
wrong with FMOD?

  • You must to post comments
0
0

Fmod player plays the wav file correctly, there might be something wrong with your player :)

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.