From c2c2dc4f7543625ad04a58315a74115c5eabf66e Mon Sep 17 00:00:00 2001 From: Andy Grundman Date: Sat, 31 Aug 2024 08:26:27 -0400 Subject: [PATCH] CoreAudio: fix mapping of 7.1 surround channels (was Ls Rs Rls Rrs, now Rls Rrs Ls Rs). CoreAudio: change 5.1 to use back surrounds instead of side to match how Sunshine configures the virtual 5.1 layout. --- .../audio/renderers/coreaudio/au_spatial_renderer.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/streaming/audio/renderers/coreaudio/au_spatial_renderer.mm b/app/streaming/audio/renderers/coreaudio/au_spatial_renderer.mm index 4d6d5514a..15d58b88a 100644 --- a/app/streaming/audio/renderers/coreaudio/au_spatial_renderer.mm +++ b/app/streaming/audio/renderers/coreaudio/au_spatial_renderer.mm @@ -148,10 +148,12 @@ OSStatus inputCallback(void *inRefCon, layout = kAudioChannelLayoutTag_Stereo; break; case 6: - layout = kAudioChannelLayoutTag_AudioUnit_5_1; // L R C LFE Ls Rs + // Back in the DVD era I remember 5.1 meant side surrounds (WAVE_5_1_A), but at some point it became back surrounds? + // layout = kAudioChannelLayoutTag_WAVE_5_1_A; // L R C LFE Ls Rs + layout = kAudioChannelLayoutTag_WAVE_5_1_B; // L R C LFE Rls Rrs break; case 8: - layout = kAudioChannelLayoutTag_AudioUnit_7_1; // L R C LFE Ls Rs Rls Rrs + layout = kAudioChannelLayoutTag_WAVE_7_1; // L R C LFE Rls Rrs Ls Rs break; case 12: layout = kAudioChannelLayoutTag_Atmos_7_1_4; // L R C LFE Ls Rs Rls Rrs Vhl Vhr Ltr Rtr @@ -161,6 +163,8 @@ OSStatus inputCallback(void *inRefCon, return false; } + // XXX Allow user to override channel layout + status = setStreamFormatAndACL(sampleRate, layout, kAudioUnitScope_Input, 0); if (status != noErr) { CA_LogError(status, "Failed to set AUSpatialRenderer input stream format to %d channels", inChannelCount);