I’m attempting to open the same output from two different audio device managers. My intent is to allow my user to play different audio streams for different purposes, but allow them to select a single output device if they wish. Consider the following test code:
toneGenerator1.reset(new ToneGenerator(440.0));
toneGenerator2.reset(new ToneGenerator(660.0));
audioDeviceManager1.initialise(0, 2, nullptr, true, {}, nullptr);
audioDeviceManager2.initialise(0, 2, nullptr, true, {}, nullptr);
audioDeviceManager1.addAudioCallback(toneGenerator1.get());
audioDeviceManager2.addAudioCallback(toneGenerator2.get());
toneGenerator1->beginTest();
toneGenerator2->beginTest();
When I run this using Windows Audio or DirectSound, both generated tones play as a mix to a single device. However, when I run the same code on macOS with CoreAudio, only the first tone is played. If I do not initialize the first device manager, then the second tone is played. If I add both callbacks to the first device manager, then both tones are played.
I am hoping to avoid writing my own layer logic on top of the Juce framework to detect when the user has selected the same device twice and reuse that device manager. It is more convenient and safe if Juce can simply mix the device manager outputs for me when necessary. Is what I am trying to do possible with Juce in a cross-platform agnostic manner, or do I need to create my own solution?
I am running with Juce 6.0 7.
