0
0

In short, I’m trying to get DirectShow to play nice with FMOD. It is working, but the difficult part is coming up with a strategy to synchronize the audio and the video.

First, I tried creating a user stream…setting the pcmreadcallback etc. This did work fairly well except that the DirectShow samples frequently vary in size and sometimes FMOD wants more data than is available. The only solution to this I can think of is to block in the callback until more audio data becomes available, but therein lies a potential world of deadlocks and race conditions that I’d rather not descend into if I can help it. If there were some way of returning how much data had been written from the callback, it would be really straight forward to keep DirectShow in lockstep with FMOD. And, if I have understood the documentation correctly, I can only use one channel to play the stream. I’d like more than one…

For the second try, I created a user sample and passed the audio straight into the sample (using lock/unlock) as it arrived from DirectShow. This does work but requires keeping tight control of the channels playing the audio. The complicating factor is that these channels might be 3D, and affect by doppler and whatever else might impact on playback speed.

The various pros and cons have me sitting on the fence. I’m wondering if anyone out there has tried something similar, or has an idea for a strategy that I might not have thought of.

All comments/suggestions are welcome.

  • You must to post comments
0
0

I would probably use the lock/unlock method, as it is the way to access the raw sound data with most flexibility. Our bink provider uses this method.

There is another way to feed pcm data to fmod, and that is through a DSP callback (using createDSP), using playDSP to play it. That is similar to a custom stream but works with smaller fixed size chunks. You would have to buffer ahead yourself in a separate buffer, then feed fmod’s callback out of that.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.