aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-04-25 00:46:41 -0700
committerChris Robinson <[email protected]>2023-04-25 00:46:41 -0700
commitaefc514ef6d1ab94ec595f5042dcbb3107f77dc9 (patch)
treeee9c6ebed4a8ba46ba0ee4f32a26851c75cad528
parent75f3e34951f165a523825472dc22bfc557277a00 (diff)
Check the correct device property to detect headphones
-rw-r--r--alc/backends/coreaudio.cpp6
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));
}
}