Automatic default audio device change on Mac

My program has both a synth and a Quicktime video player. The Quicktime video player’s audio always goes out whatever audio output device the OS is set to (in the Audio and Midi Settings app), and I have no way of changing that. However, the synth is using JUCE’s AudioDeviceManager. Normally I would allow the user to change the synth’s audio output device from within my program, but since they can’t do this for the video, I’d rather both the video AND synth stick to the system’s audio output device.

Problem is, if the user changes the system’s audio output device while my program is open, Quicktime’s audio out changes, but not the JUCE AudioDeviceManager’s output. I have to restart my program to get the AudioDeviceManager to switch over to the new audio out. On Windows it switches automatically without a problem, but not on Mac. Any ideas on how to get this working without restarting the program?

It’d need some kind of event callback to listen for CoreAudio device changes, and would have to respond to that… It’s probably not too hard to set up, but I’ve never looked into exactly how it’d be done.

K. Will look into that. Thnx.

Hi, I want to play a wave file via an ASIO device. I'm able to play audio, but on the default audio device. I've gone through the juce api & forum but can't get how to change an audio device.

Is there a source example of making an ASIO device the current audio device?

Have you enabled JUCE_ASIO ?

If so, it'll just show up in the list with your other devices.

Yes I've enabled it & 1) asio devices show - via AudioDeviceManager::getAvailableDeviceTypes() 2) they show in the AudioDeviceSelectorComponent(...) and the test button plays some sound. 3) I'm also able to open them and see their various parameter values.
The main challenge is how get them to play in my code, with AudioIODevice::start(AudioIODeviceCallback * callback) method. The AudioIODeviceCallback documentation is confusing to me.

Sorry, it's not clear what you're having a problem with..?

ASIO devices aren't a special case. If you follow the various examples that we have for playing audio, they'll work exactly the same regardless of whether the device is ASIO or any other kind.

I'm able to play audio, but on the current default device. I would like to change the device (to any of the available, e.g. ASIO Streamware) and I'm not able to do that.
I've attached an ouput program for the method which lists avaialble devices & its source code in audio application project.

void showDevices()
        String text = String("Available devices...\n").toUpperCase();
        AudioIODeviceType* devType;

        for (int i = 0; i < deviceManager.getAvailableDeviceTypes().size(); ++i)
            devType = deviceManager.getAvailableDeviceTypes()[i];
            StringArray devicesNames = devType->getDeviceNames();

            text += devType->getTypeName() + "\n";
            for (int j = 0; j < devicesNames.size(); ++j)
                text += "\t" + devicesNames[j] + "\n";
            text += "\n";

        text += "Current device type: " + deviceManager.getCurrentAudioDeviceType() + "\n";
        text += "Current device: " + deviceManager.getCurrentAudioDevice()->getName() + "\n";
        info.setText(text, dontSendNotification);


Have you called setCurrentAudioDeviceType() ?

no i hadn't. but now i have, and it worked when i did. thanks.