From e3b0713e40b94b3f0240109ecee53232c616056e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 24 Feb 2020 12:07:18 -0800 Subject: [PATCH] Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output --- src/audio/coreaudio/SDL_coreaudio.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 10962c5db..68aae3578 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -855,6 +855,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) AVAudioSession* session = [AVAudioSession sharedInstance]; [session setPreferredSampleRate:this->spec.freq error:nil]; this->spec.freq = (int)session.sampleRate; +#if TARGET_OS_TV if (iscapture) { [session setPreferredInputNumberOfChannels:this->spec.channels error:nil]; this->spec.channels = session.preferredInputNumberOfChannels; @@ -862,6 +863,9 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) [session setPreferredOutputNumberOfChannels:this->spec.channels error:nil]; this->spec.channels = session.preferredOutputNumberOfChannels; } +#else + /* Calling setPreferredOutputNumberOfChannels seems to break audio output on iOS */ +#endif /* TARGET_OS_TV */ } #endif