Skip to content

Commit

Permalink
Stop CoreAudio from doing expensive audio rate conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 23, 2017
1 parent a976255 commit 71a4e8e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/audio/coreaudio/SDL_coreaudio.m
Expand Up @@ -734,6 +734,13 @@ static BOOL update_audio_session(_THIS, SDL_bool open)
if (!update_audio_session(this, SDL_TRUE)) {
return -1;
}

/* Stop CoreAudio from doing expensive audio rate conversion */
@autoreleasepool {
AVAudioSession* session = [AVAudioSession sharedInstance];
[session setPreferredSampleRate:this->spec.freq error:nil];
this->spec.freq = (int)session.sampleRate;
}
#endif

/* Setup a AudioStreamBasicDescription with the requested format */
Expand Down

0 comments on commit 71a4e8e

Please sign in to comment.