File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -769,21 +769,35 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
769
769
// L R C LFE Cs Ls Rs
770
770
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1 ;
771
771
} else {
772
- // FIXME: We need to manually swizzle channels into a supported layout
773
772
// L R C LFE Ls Rs Cs
774
- // layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A;
775
- return SDL_SetError (" Unsupported audio channels" );
773
+ layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A ;
774
+
775
+ // Convert from SDL channel layout to kAudioChannelLayoutTag_MPEG_6_1_A
776
+ static const int swizzle_map[7 ] = {
777
+ 0 , 1 , 2 , 3 , 6 , 4 , 5
778
+ };
779
+ device->chmap = SDL_ChannelMapDup (swizzle_map, SDL_arraysize (swizzle_map));
780
+ if (!device->chmap ) {
781
+ return false ;
782
+ }
776
783
}
777
784
break ;
778
785
case 8 :
779
786
if (@available (macOS 10.15 , iOS 13.0 , tvOS 13.0 , *)) {
780
787
// L R C LFE Rls Rrs Ls Rs
781
788
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1 ;
782
789
} else {
783
- // FIXME: We need to manually swizzle channels into a supported layout
784
790
// L R C LFE Ls Rs Rls Rrs
785
- // layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C;
786
- return SDL_SetError (" Unsupported audio channels" );
791
+ layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C ;
792
+
793
+ // Convert from SDL channel layout to kAudioChannelLayoutTag_MPEG_7_1_C
794
+ static const int swizzle_map[8 ] = {
795
+ 0 , 1 , 2 , 3 , 6 , 7 , 4 , 5
796
+ };
797
+ device->chmap = SDL_ChannelMapDup (swizzle_map, SDL_arraysize (swizzle_map));
798
+ if (!device->chmap ) {
799
+ return false ;
800
+ }
787
801
}
788
802
break ;
789
803
default :
You can’t perform that action at this time.
0 commit comments