(CoreAudio) Add backwards compatibility

This commit is contained in:
twinaphex 2017-01-29 19:54:58 +01:00
parent 343ac9fea7
commit 6cde73d86f

View File

@ -135,14 +135,17 @@ static void choose_output_device(coreaudio_t *dev, const char* device)
{ {
unsigned i; unsigned i;
UInt32 deviceCount; UInt32 deviceCount;
AudioDeviceID *devices = NULL; AudioObjectPropertyAddress propaddr;
AudioObjectPropertyAddress propaddr = AudioDeviceID *devices = NULL;
{ UInt32 size = 0;
kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeOutput, propaddr.mSelector = kAudioHardwarePropertyDevices;
kAudioObjectPropertyElementMaster #if MAC_OS_X_VERSION_10_12
}; propaddr.mScope = kAudioObjectPropertyScopeOutput;
UInt32 size = 0; #else
propaddr.mScope = kAudioObjectPropertyScopeGlobal;
#endif
propaddr.mElement = kAudioObjectPropertyElementMaster;
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
&propaddr, 0, 0, &size) != noErr) &propaddr, 0, 0, &size) != noErr)
@ -155,6 +158,10 @@ static void choose_output_device(coreaudio_t *dev, const char* device)
&propaddr, 0, 0, &size, devices) != noErr) &propaddr, 0, 0, &size, devices) != noErr)
goto done; goto done;
#if MAC_OS_X_VERSION_10_12
#else
propaddr.mScope = kAudioDevicePropertyScopeOutput;
#endif
propaddr.mSelector = kAudioDevicePropertyDeviceName; propaddr.mSelector = kAudioDevicePropertyDeviceName;
for (i = 0; i < deviceCount; i ++) for (i = 0; i < deviceCount; i ++)