Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output
authorSam Lantinga
Mon, 24 Feb 2020 12:07:18 -0800
changeset 13550058a6b076676
parent 13549 dfe181848aba
child 13551 4efb3eb7a3b3
Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio output
src/audio/coreaudio/SDL_coreaudio.m
     1.1 --- a/src/audio/coreaudio/SDL_coreaudio.m	Mon Feb 24 10:25:57 2020 -0800
     1.2 +++ b/src/audio/coreaudio/SDL_coreaudio.m	Mon Feb 24 12:07:18 2020 -0800
     1.3 @@ -855,6 +855,7 @@
     1.4          AVAudioSession* session = [AVAudioSession sharedInstance];
     1.5          [session setPreferredSampleRate:this->spec.freq error:nil];
     1.6          this->spec.freq = (int)session.sampleRate;
     1.7 +#if TARGET_OS_TV
     1.8          if (iscapture) {
     1.9              [session setPreferredInputNumberOfChannels:this->spec.channels error:nil];
    1.10              this->spec.channels = session.preferredInputNumberOfChannels;
    1.11 @@ -862,6 +863,9 @@
    1.12              [session setPreferredOutputNumberOfChannels:this->spec.channels error:nil];
    1.13              this->spec.channels = session.preferredOutputNumberOfChannels;
    1.14          }
    1.15 +#else
    1.16 +		/* Calling setPreferredOutputNumberOfChannels seems to break audio output on iOS */
    1.17 +#endif /* TARGET_OS_TV */
    1.18      }
    1.19  #endif
    1.20