coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 24 May 2017 01:28:03 -0400
changeset 110230b4a3c824d38
parent 11022 ad26a063ffff
child 11024 32026cc5015a
coreaudio: looks like we need more like a 10ms buffer minimum, not 50ms.
src/audio/coreaudio/SDL_coreaudio.m
     1.1 --- a/src/audio/coreaudio/SDL_coreaudio.m	Wed May 24 00:12:22 2017 -0400
     1.2 +++ b/src/audio/coreaudio/SDL_coreaudio.m	Wed May 24 01:28:03 2017 -0400
     1.3 @@ -665,11 +665,11 @@
     1.4      }
     1.5  
     1.6      /* Make sure we can feed the device at least 50 milliseconds at a time. */
     1.7 -    const double msecs = (this->spec.size / ((double) this->spec.freq)) * 1000.0;
     1.8 -    if (msecs >= 50.0) {
     1.9 +    const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0;
    1.10 +    if (msecs >= 10.0) {
    1.11          this->hidden->numAudioBuffers = 2;
    1.12      } else {
    1.13 -        this->hidden->numAudioBuffers = (int) (SDL_ceil(50.0 / msecs) * 2);
    1.14 +        this->hidden->numAudioBuffers = (int) (SDL_ceil(10.0 / msecs) * 2);
    1.15      }
    1.16  
    1.17      this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * this->hidden->numAudioBuffers);