[Scummvm-cvs-logs] SF.net SVN: scummvm:[47558] scummvm/trunk/backends/platform/sdl/sdl.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Jan 25 18:59:14 CET 2010


Revision: 47558
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47558&view=rev
Author:   lordhoto
Date:     2010-01-25 17:59:05 +0000 (Mon, 25 Jan 2010)

Log Message:
-----------
Fix sample buffer calculation. Now it really asks for a buffer of 2048 samples for 22050Hz, like the comment states.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/sdl.cpp

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2010-01-25 17:30:59 UTC (rev 47557)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2010-01-25 17:59:05 UTC (rev 47558)
@@ -715,12 +715,12 @@
 		_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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list