Skip to content

Commit

Permalink
coreaudio: convert MPEG channel layout to WAVE channel layout
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 15, 2025
1 parent 49dd24e commit c386b5d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/audio/coreaudio/SDL_coreaudio.m
Original file line number Diff line number Diff line change
Expand Up @@ -769,21 +769,27 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
// L R C LFE Cs Ls Rs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1;
} else {
// FIXME: We need to manually swizzle channels into a supported layout
// L R C LFE Ls Rs Cs
//layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A;
return SDL_SetError("Unsupported audio channels");
layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A;

int swizzle_map[7] = {
0, 1, 2, 3, 6, 4, 5
};
device->chmap = SDL_ChannelMapDup(swizzle_map, SDL_arraysize(swizzle_map));
}
break;
case 8:
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
// L R C LFE Rls Rrs Ls Rs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1;
} else {
// FIXME: We need to manually swizzle channels into a supported layout
// L R C LFE Ls Rs Rls Rrs
//layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C;
return SDL_SetError("Unsupported audio channels");
layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C;

int swizzle_map[8] = {
0, 1, 2, 3, 6, 7, 4, 5
};
device->chmap = SDL_ChannelMapDup(swizzle_map, SDL_arraysize(swizzle_map));
}
break;
default:
Expand Down

0 comments on commit c386b5d

Please sign in to comment.