0
0

I have 2 low level systems which output to 2 different audio devices. The audio from the first system is mirrored to the second system using 2 custom DSPs.

The first system has a custom “recording” DSP, which reads the audio as it passes through (in the read callback), and copies that PCM data into an audio buffer.

The second system reads the PCM data stored in that same audio buffer, and outputs it to the other device (also using the read callback), using a custom “playback” DSP.

Everything is working as it should, but there is quite a bit of noticeable latency between the 2 systems, which I’m trying to reduce.
I noticed that the read callbacks of both DSPs don’t always happen in the same order. Sometimes the recording DSP will write to the audio buffer twice, before it is read by the playback DSP on the other system, or vice versa. This forces me to increase the size of the audio buffer storing the PCM data, and filling it with enough data before reading, causing extra latency.

Is there a way to sync the read callback of both DSPs, so that they are guaranteed to always happen in the same order and frequency?
I’ve tried initializing both systems with the FMOD.INIT_MIX_FROM_UPDATE flag and updating them manually, but that did not seem to have any affect.
I guess these callbacks are called from different threads, so not sure if it’s at all possible.

  • You must to post comments
0
0

FMOD.INIT_MIX_FROM_UPDATE only applies to polling based output modes such as FMOD_OUTPUTTYPE_NOSOUND, FMOD_OUTPUTTYPE_WAVWRITER, FMOD_OUTPUTTYPE_DSOUND, FMOD_OUTPUTTYPE_WINMM,FMOD_OUTPUTTYPE_XAUDIO.
https://fmod.com/resources/documentation-api?page=content/generated/FMOD_INITFLAGS.html#/

You would be best off using DSOUND with INIT_MIX_FROM_UPDATE, this will give you full control over when the mixing occurs. Although you may run into drift due to the two different devices having different clock speeds, E.g. soundcard A’s 48 kHz is slightly different to soundcard B’s 48 kHz.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.