Skip to content

Commit 1219934

Browse files
committed
prepare_audioqueue: legacy OS compatibility fix
1 parent 158c088 commit 1219934

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/audio/coreaudio/SDL_coreaudio.m

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,14 +880,25 @@ static int prepare_audioqueue(_THIS)
880880
// L R C LFE Ls Rs
881881
layout.mChannelLayoutTag = kAudioChannelLayoutTag_DVD_12;
882882
break;
883+
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || \
884+
(defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101500)
883885
case 7:
884886
// L R C LFE Cs Ls Rs
885-
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1;
887+
if (@available(macOS 10.15, iOS 13, *)) {
888+
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1;
889+
} else {
890+
return SDL_SetError("Unsupported audio channels");
891+
}
886892
break;
887893
case 8:
888894
// L R C LFE Rls Rrs Ls Rs
889-
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1;
895+
if (@available(macOS 10.15, iOS 13, *)) {
896+
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1;
897+
} else {
898+
return SDL_SetError("Unsupported audio channels");
899+
}
890900
break;
901+
#endif
891902
default:
892903
return SDL_SetError("Unsupported audio channels");
893904
}

0 commit comments

Comments
 (0)