From 29b03d133e5382ce51fa002d30c9b33440b61541 Mon Sep 17 00:00:00 2001 From: Colin Cornaby Date: Fri, 8 Nov 2024 17:25:25 -0800 Subject: [PATCH] Switching to Audio Channel Layout attribute kAudioDevicePropertyPreferredChannelLayout seems to be unavailable on iOS --- alc/backends/coreaudio.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 781ca3e5e..f7fbc34bd 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -197,7 +197,7 @@ std::string GetDeviceName(AudioDeviceID devId) UInt32 GetDeviceChannelCount(AudioDeviceID devId, bool isCapture) { UInt32 propSize{}; - auto err = GetDevPropertySize(devId, kAudioDevicePropertyPreferredChannelLayout, isCapture, 0, + auto err = GetDevPropertySize(devId, kAudioUnitProperty_AudioChannelLayout, isCapture, 0, &propSize); if(err) { @@ -209,7 +209,7 @@ UInt32 GetDeviceChannelCount(AudioDeviceID devId, bool isCapture) auto channel_data = std::make_unique(propSize); auto *channel_layout = reinterpret_cast(channel_data.get()); - err = GetDevProperty(devId, kAudioDevicePropertyPreferredChannelLayout, isCapture, 0, propSize, + err = GetDevProperty(devId, kAudioUnitProperty_AudioChannelLayout, isCapture, 0, propSize, channel_layout); if(err) { @@ -609,7 +609,7 @@ bool CoreAudioPlayback::reset() if(err == noErr) { - err = AudioUnitGetProperty(mAudioUnit, kAudioDevicePropertyPreferredChannelLayout, kAudioUnitScope_Output, OutputElement, layout.get(), &propSize); + err = AudioUnitGetProperty(mAudioUnit, kAudioUnitProperty_AudioChannelLayout, kAudioUnitScope_Output, OutputElement, layout.get(), &propSize); std::vector labels = std::vector(layout.get()->mNumberChannelDescriptions);