fixed buffer size calculation

every sample rate works now
This commit is contained in:
spacy51 2007-12-06 17:30:43 +00:00
parent 54284bd177
commit 4656f65231
2 changed files with 6 additions and 4 deletions

View File

@ -156,7 +156,9 @@ bool DirectSound::init()
}
freq = 44100 / soundQuality;
soundBufferLen = freq*2*2/60;
// calculate the number of samples per frame first
// then multiply it with the size of a sample frame (16 bit * stereo)
soundBufferLen = ( freq / 60 ) * 4;
soundBufferTotalLen = soundBufferLen * 10;
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );

View File

@ -178,9 +178,9 @@ bool OpenAL::init()
assert( AL_NO_ERROR == alGetError() );
freq = 44100 / soundQuality;
soundBufferLen = freq * 2 * 2 / 60;
// 16bit stereo, buffer can store the sound for 1 frame in 60Hz
// calculate the number of samples per frame first
// then multiply it with the size of a sample frame (16 bit * stereo)
soundBufferLen = ( freq / 60 ) * 4;
setsystemSoundOn( true );