Truly independent web browser
LibAudio+Tests: Read the AudioUnit 7.1 layout in its channel order
Aliaksandr Kalenikcec224b7e5f6
diff --git a/Libraries/LibAudio/CoreAudioChannelLayout.cpp b/Libraries/LibAudio/CoreAudioChannelLayout.cppindex 10aeab9fa72..fa069ec38a3 100644--- a/Libraries/LibAudio/CoreAudioChannelLayout.cpp+++ b/Libraries/LibAudio/CoreAudioChannelLayout.cpp@@ -73,8 +73,9 @@ ErrorOr<ChannelMap> core_audio_channel_layout_to_channel_map(AudioChannelLayoutreturn ChannelMap::quadrophonic();if (channel_layout.mChannelLayoutTag == kAudioChannelLayoutTag_AudioUnit_5_1)return ChannelMap::surround_5_1();+ // This tag puts its side surround channels before its rear surround channels.if (channel_layout.mChannelLayoutTag == kAudioChannelLayoutTag_AudioUnit_7_1)- return ChannelMap::surround_7_1();+ return ChannelMap(Channel::FrontLeft, Channel::FrontRight, Channel::FrontCenter, Channel::LowFrequency, Channel::SideLeft, Channel::SideRight, Channel::BackLeft, Channel::BackRight);Vector<Channel, ChannelMap::capacity()> channels;diff --git a/Tests/LibAudio/TestCoreAudioChannelLayout.cpp b/Tests/LibAudio/TestCoreAudioChannelLayout.cppindex 4df4ed871f8..1dcc49438ff 100644--- a/Tests/LibAudio/TestCoreAudioChannelLayout.cpp+++ b/Tests/LibAudio/TestCoreAudioChannelLayout.cpp@@ -126,3 +126,21 @@ TEST_CASE(channel_bitmap_names_its_top_rear_speakers)Audio::Channel::TopBackCenter,Audio::Channel::TopBackRight));}++TEST_CASE(audio_unit_7_1_layout_puts_its_side_channels_before_its_back_channels)+{+ AudioChannelLayout layout {};+ layout.mChannelLayoutTag = kAudioChannelLayoutTag_AudioUnit_7_1;++ auto channel_map = MUST(Audio::core_audio_channel_layout_to_channel_map(layout, sizeof(layout)));+ EXPECT_EQ(channel_map,+ Audio::ChannelMap(+ Audio::Channel::FrontLeft,+ Audio::Channel::FrontRight,+ Audio::Channel::FrontCenter,+ Audio::Channel::LowFrequency,+ Audio::Channel::SideLeft,+ Audio::Channel::SideRight,+ Audio::Channel::BackLeft,+ Audio::Channel::BackRight));+}