I have used FMOD to play data for a while now. I am just getting into recording, but the interface is confusing to me.

I would have expected something like this:
1) Setup sample1
2) Setup sample2
3) Start sampling on 1, signal a callback when it reaches the end
4) wait for callback and/or check user clicking “stop/pause”, etc.
5) when callback is signaled, immediately start sampling on 2 with a callback when it reaches the end
6) write Sample1 data to disk
7) wait for callback
8) when callback is signaled, immediately start sampling on 1 with callback
9) write Sample2 data to disk
10) goto 4

But, I don’t see where there are recording callbacks. So, I think my model is wrong.

What do I need to do to record live data of an unknown beforehand length? I had thought to setup the two samples for one minute of data each, thereby giving me more than enough time to write the data between switching each sample, with the ability to stop at any time from the user.

  • Rick C. Hodgin
  • You must to post comments

[quote="brett":ukt48lr7]you have to specify a length for the recorder to record to.
If you want an unknown length, you will have to stream the data out yourself by locking and unlocking the stream buffer, using FSOUND_Record_GetPosition to find where the record cursor is.[/quote:ukt48lr7]

That is what I gathered from the documentation, though it seems like a really clunky recording solution. Also, the FSOUND_Record_GetPosition() function documentation specifies that it is not accurately reflecting the “recording cursor”, just the most recently written to portion of the sample buffer from the live recording. So how far out of synch will it be? Just a few samples? Or possibly 10s of milliseconds?

And is there some reason the FMOD does not allow the FSOUND_Record_StartSample() function to have a callback when the record sample end is reached? Or possibly a way to specify two samples to record back and forth, with a notification when it switches from one to the other in some kind of perpetual loop mode?

Something like:
// Allocate two samples
sample1 = FSOUND_Sample_Alloc(…); // 60 seconds worth
sample2 = FSOUND_Sample_Alloc(…); // 60 seconds worth

// Record continuously back and forth looping from 1 to 2, then back to 1 and repeating
FSOUND_Record_StartSample_Continuous(FSOUND_SAMPLE *sample1, FSOUND_SAMPLE *sample2, FSOUND_RECORDCALLBACK user_record, void *user_data);

In that way the application doing the recording could handle continuous recording extremely easily and without the clumsy and out-of-synch method of constantly polling FSOUND_Record_GetPosition() to find out where in the single buffer the recording is taking place, then extracting a portion of it before it loops around, etc.

  • Rick C. Hodgin
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.