Fix sample buffer calculation. Now it really asks for a buffer of 2048 samples for 22050Hz, like the comment states.
svn-id: r47558
This commit is contained in:
parent
dfafec6486
commit
157a1df30d
1 changed files with 4 additions and 4 deletions
|
@ -715,12 +715,12 @@ void OSystem_SDL::setupMixer() {
|
||||||
_samplesPerSec = SAMPLES_PER_SEC;
|
_samplesPerSec = SAMPLES_PER_SEC;
|
||||||
|
|
||||||
// Determine the sample buffer size. We want it to store enough data for
|
// 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.
|
// at least 1/16th of a second (though at maximum 8192 samples). Note
|
||||||
// So e.g. at 22050 Hz, we request a sample buffer size of 2048.
|
// 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;
|
int samples = 8192;
|
||||||
while (16 * samples >= _samplesPerSec) {
|
while (samples * 16 > _samplesPerSec * 2)
|
||||||
samples >>= 1;
|
samples >>= 1;
|
||||||
}
|
|
||||||
|
|
||||||
memset(&desired, 0, sizeof(desired));
|
memset(&desired, 0, sizeof(desired));
|
||||||
desired.freq = _samplesPerSec;
|
desired.freq = _samplesPerSec;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue