Hey, I have a problem with a FMOD which I havn’t been able to find a solution for myself.

I have an application which receives raw sound data (via tcp) of various size.
The raw sound data is of the type FMOD_SOUND_FORMAT_PCM16, 16kHz stereo.

In this application I have an FMOD stream running created with these flags:

The numchannels, format, defaultfrequency fields of FMOD_CREATESOUNDEXINFO are set to the sound format mentioned above.
In my stream callback, sound data is added to the stream from a simple std queue.

Now to the problem: When sound data is received in this application, I am simply pushing it to this queue. If the size of the data is more than about 1000 bytes, everything works perfectly. But if the size is less, the sound "lags" as if the stream doesn’t get data quickly enough.

So, how can I feed smaller amounts of sound data into that queue (and so into the fmod stream) without getting a worthless, laggy sound?
Perhaps the decodebuffersize and length fields of the FMOD_CREATESOUNDEXINFO struct matters, but I am not sure how to use these properly.

EDIT: Oh, some other questions. Let’s say that the sound data this application receives is from different users in a real-time voice chat, is using a stream (and feeding it through a queue) the correct approach for playback? Should I be using hardware or software? Will the final sound output be of nice quality if just pushing data onto that queue (even if the sound data is from different users)? Clearly, I need some guidance :)

Grateful for any help.

  • You must to post comments

Streams are polled on their own thread and only updated roughly every 10ms, so for tiny buffers, no, you are not going to be using streams. You have to use bigger buffers and do the buffering logic yourself.

For the lowest latency audio callback use a custom DSP unit, which is floating point format only, but is called from directly within the mixer. You don’t get to choose the callback data length either, but it is very small.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.