diff options
author | Johannes Schickel | 2010-01-25 17:59:05 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-25 17:59:05 +0000 |
commit | 157a1df30d270b5bcc8a264fec0acd1e71fd7d4a (patch) | |
tree | 82c534d622a1a5a24391c8c4a7a54020342d362a /backends/platform | |
parent | dfafec64869f21924da3d8edd5796b397728fb98 (diff) | |
download | scummvm-rg350-157a1df30d270b5bcc8a264fec0acd1e71fd7d4a.tar.gz scummvm-rg350-157a1df30d270b5bcc8a264fec0acd1e71fd7d4a.tar.bz2 scummvm-rg350-157a1df30d270b5bcc8a264fec0acd1e71fd7d4a.zip |
Fix sample buffer calculation. Now it really asks for a buffer of 2048 samples for 22050Hz, like the comment states.
svn-id: r47558
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 9eeb170981..356f881830 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -715,12 +715,12 @@ void OSystem_SDL::setupMixer() { _samplesPerSec = SAMPLES_PER_SEC; // Determine the sample buffer size. We want it to store enough data for - // about 1/16th of a second. Note that it must be a power of two. - // So e.g. at 22050 Hz, we request a sample buffer size of 2048. + // at least 1/16th of a second (though at maximum 8192 samples). Note + // that it must be a power of two. So e.g. at 22050 Hz, we request a + // sample buffer size of 2048. int samples = 8192; - while (16 * samples >= _samplesPerSec) { + while (samples * 16 > _samplesPerSec * 2) samples >>= 1; - } memset(&desired, 0, sizeof(desired)); desired.freq = _samplesPerSec; |