Skip to content

Commit

Permalink
Don't call setPreferredOutputNumberOfChannels on iOS, it breaks audio…
Browse files Browse the repository at this point in the history
… output
  • Loading branch information
slouken committed Feb 24, 2020
1 parent 2c9871a commit e3b0713
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/audio/coreaudio/SDL_coreaudio.m
Expand Up @@ -855,13 +855,17 @@ static BOOL update_audio_session(_THIS, SDL_bool open)
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;
} else {
[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

Expand Down

0 comments on commit e3b0713

Please sign in to comment.