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.
- nci asked 14 years ago
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)
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”
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.
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));
I ll see this afternoon if i can test this code in VB
Please login first to submit.