0
0

Hi,
I’m using FLAC files for sound playback. Since seeking in FLAC’s takes up to 50ms, I’m thinking of running FMODEx in a dedicated worker thread. That would allow me to do some pixelshader eyecandy on screen while FMODEx is seeking to the new file positions.

Wondering if this approach is generally possible. Since the worker thread should handle all calls to FMODEx to avoid thread safety issues, I could no longer guarantee calls to System::update() every frame.
The API doc says “If this is not called when using Channels and 3D sound, then incorrect results could occur.”

I am using hardware 3D sounds. Most likely there won’t be any sounds playing during the seek (perhaps just a simple hardware 3D mono sound at a fixed 3D position).

Would the worker thread approach be feasible or are there certain problems arising?

Cheers,
JoJo

  • You must to post comments
0
0

I would be using a command queue which will be processed by the worker thread. That way only one API call will happen at a time. When the command queue is empty the worker thread will then call update and then sleep for a bit. Using [code:1i1zw0wi]InitializeCriticalSectionAndSpinCount(&_oCS, SPIN_COUNT);[/code:1i1zw0wi] should also help to avoid context switches during access of the command queue on our DualCore CPU box.

Regarding hardware 3D sound: If the sound position does not change, do I still need to call update() regurlarly for WAV files so that they are being fed properly to the soundcard hardware? Or is it ok to miss a couple of frames in that case?

Cheers,
JoJo

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.