Fixed bug 1679 - Error in buffer size setting in Haiku/BeOS audio driver
authorSam Lantinga <slouken@libsdl.org>
Mon, 11 Feb 2013 20:56:34 -0800
changeset 6856245a50142ffb
parent 6854 7b1d78036e84
child 6857 dd4c12f0358b
Fixed bug 1679 - Error in buffer size setting in Haiku/BeOS audio driver

PulkoMandy

Just like in SDL, audio buffer sizes for BeOS and Haiku BSoundPlayer are sized
in bytes, not frames. SDL was feeding the wrong value, leading to buffers
smaller than expected and weird behaviour in some unsuspecting programs
(noticed it in HivelyTracker but others are likely affected as well. The fix is
fortunately very simple
src/audio/baudio/SDL_beaudio.cc
     1.1 --- a/src/audio/baudio/SDL_beaudio.cc	Mon Feb 11 18:28:05 2013 -0800
     1.2 +++ b/src/audio/baudio/SDL_beaudio.cc	Mon Feb 11 20:56:34 2013 -0800
     1.3 @@ -151,8 +151,6 @@
     1.4          }
     1.5      }
     1.6  
     1.7 -    format.buffer_size = _this->spec.samples;
     1.8 -
     1.9      if (!valid_datatype) {      /* shouldn't happen, but just in case... */
    1.10          BEOSAUDIO_CloseDevice(_this);
    1.11          SDL_SetError("Unsupported audio format");
    1.12 @@ -162,6 +160,8 @@
    1.13      /* Calculate the final parameters for this audio specification */
    1.14      SDL_CalculateAudioSpec(&_this->spec);
    1.15  
    1.16 +    format.buffer_size = _this->spec.size;
    1.17 +
    1.18      /* Subscribe to the audio stream (creates a new thread) */
    1.19      sigset_t omask;
    1.20      SDL_MaskSignals(&omask);