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.