0
0

The program that I’m writing needs to be notified each time FMOD requests more data from a stream. Am I stuck writing my own stream callback function or can I do something like this:

extern "C" signed char mystreamcb(FSOUND_STREAM *s, void *b, int len, int param)
{
// do the stuff I need to do..

// dispatch to FSOUND's stream handler.
return FSOUND_FileStreamCB(s,b,len,param);

}

I suppose my other recourse would be to load the file into memory and do a simple memory stream, but since the files that I’m playing could be large (one to two minutes, 44.1KHz, 16bit, stereo), I’m not sure I want to burn that much RAM (heh … 10meg … it’s not THAT much memory, but still…)

If I do go the "load it into memory" path, I will want to leverage as much of FMOD as I can; what is the best way to load the sample (may be an MP3 😉 and get the sample data into a raw PCM format that I can spoon-feed to FMOD via a callback?

— Pryankster

  • You must to post comments
0
0

What about writing a simple set of file callback routines? This way, FMOD goes through your file callback routines to read more data and you know exactly when it is happening and how much data is read.

  • You must to post comments
0
0

FSOUND_Stream_Create (DSP? my docs just say FSOUND_Stream_Create() … ) is probably what I want, but I want to leverage the sound file reading functions of FMOD (mp3, wav, etc.)

If I load the wav as a sample, how can I get the data from it? (FSOUND_Sample_Lock() ?) Should I (can I?) lock the sample buffer, read the data that I need and then unlock it again … will that work for MP3s? when are MP3 samples decoded? on the fly?

Thanks for you prompt reply!
–Pryankster

  • You must to post comments
0
0

Excellent! that sounds like EXACTLY what I’m looking for.

Thanks!

— Pryankster

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.