Playing several audio sources synchronously



First of all I am new to JUCE so I do apologise if my question sounds dumb to some of you :wink: This is my first topic on that forum.

Here it is: I am trying to make a piece of code that will read several audio sources (coming from .wav files) simultaneously. I’ve manage to work out a solution with a MixerAudioSource that takes several AudioTransportSource that have been built with AudioFormatReaderSource objects that read my .wav files. But, correct me if I’m wrong, this solution is not good enough since I have to iterate through my AudioTransportSource objects, and call AudioTransportSource::start() one by one. Therefore, the samples playback will not start exactly at the same time (there will be a slight delay, the time between 2 calls to the play() method).

Is there any simple solution to my problem?

Thanks a lot!


I think you should probably be mixing then and THEN putting them through a transport control!


Well that sounds quite sensible indeed, thanks. I still have one question though: the AudioTransportSource takes into account only files inherited from PositionableAudioSource, which is not the case of the mixer… Should I create my own custom Mixer class, of is there an easier workaround?