Skip to content

Commit

Permalink
coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 24, 2017
1 parent 793c788 commit 3fd35f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/audio/coreaudio/SDL_coreaudio.m
Expand Up @@ -665,11 +665,11 @@ static BOOL update_audio_session(_THIS, SDL_bool open)
}

/* Make sure we can feed the device at least 50 milliseconds at a time. */
const double msecs = (this->spec.size / ((double) this->spec.freq)) * 1000.0;
if (msecs >= 50.0) {
const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0;
if (msecs >= 10.0) {
this->hidden->numAudioBuffers = 2;
} else {
this->hidden->numAudioBuffers = (int) (SDL_ceil(50.0 / msecs) * 2);
this->hidden->numAudioBuffers = (int) (SDL_ceil(10.0 / msecs) * 2);
}

this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * this->hidden->numAudioBuffers);
Expand Down

0 comments on commit 3fd35f6

Please sign in to comment.