aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-25 17:59:05 +0000
committerJohannes Schickel2010-01-25 17:59:05 +0000
commit157a1df30d270b5bcc8a264fec0acd1e71fd7d4a (patch)
tree82c534d622a1a5a24391c8c4a7a54020342d362a /backends/platform/sdl
parentdfafec64869f21924da3d8edd5796b397728fb98 (diff)
downloadscummvm-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/sdl')
-rw-r--r--backends/platform/sdl/sdl.cpp8
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;