diff options
-rw-r--r-- | alc/backends/coreaudio.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 86f58637..6a8003d2 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -41,6 +41,7 @@ #include <AudioUnit/AudioUnit.h> #include <AudioToolbox/AudioToolbox.h> +#include <IOKit/audio/IOAudioTypes.h> namespace { @@ -392,17 +393,16 @@ void CoreAudioPlayback::open(const char *name) if(audioDevice != kAudioDeviceUnknown) { UInt32 type{}; - err = GetDevProperty(audioDevice, kAudioDevicePropertyTransportType, false, + err = GetDevProperty(audioDevice, kAudioDevicePropertyDataSource, false, kAudioObjectPropertyElementMaster, sizeof(type), &type); if(err != noErr) ERR("Failed to get audio device type: %u\n", err); else { - static constexpr UInt32 HeadphoneType{('h'<<24u) | ('d'<<16u) | ('p'<<8u) | 'n'}; TRACE("Got device type '%c%c%c%c'\n", static_cast<char>((type>>24)&0xff), static_cast<char>((type>>16)&0xff), static_cast<char>((type>>8)&0xff), static_cast<char>(type&0xff)); - mDevice->Flags.set(DirectEar, (type == HeadphoneType)); + mDevice->Flags.set(DirectEar, (type == kIOAudioOutputPortSubTypeHeadphones)); } } |