From d3f097c7f1fa8949b44016916e2ebbae38f6e938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kr=C3=B6ner?= Date: Tue, 6 Mar 2018 23:08:46 +0100 Subject: [PATCH] Honor 'device "system"' setting for OSX output --- src/output/plugins/OSXOutputPlugin.cxx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/output/plugins/OSXOutputPlugin.cxx b/src/output/plugins/OSXOutputPlugin.cxx index b7baf785e..a198cdb86 100644 --- a/src/output/plugins/OSXOutputPlugin.cxx +++ b/src/output/plugins/OSXOutputPlugin.cxx @@ -138,15 +138,25 @@ AudioOutput * OSXOutput::Create(EventLoop &, const ConfigBlock &block) { OSXOutput *oo = new OSXOutput(block); - - AudioObjectPropertyAddress aopa = { - kAudioHardwarePropertyDefaultOutputDevice, - kAudioObjectPropertyScopeOutput, - kAudioObjectPropertyElementMaster - }; - + AudioObjectPropertyAddress aopa; AudioDeviceID dev_id = kAudioDeviceUnknown; UInt32 dev_id_size = sizeof(dev_id); + + if (oo->component_subtype == kAudioUnitSubType_SystemOutput) + // get system output dev_id if configured + aopa = { + kAudioHardwarePropertyDefaultSystemOutputDevice, + kAudioObjectPropertyScopeOutput, + kAudioObjectPropertyElementMaster + }; + else + // fallback to default device initially (can still be changed by osx_output_set_device) + aopa = { + kAudioHardwarePropertyDefaultOutputDevice, + kAudioObjectPropertyScopeOutput, + kAudioObjectPropertyElementMaster + }; + AudioObjectGetPropertyData(kAudioObjectSystemObject, &aopa, 0,