fixed buffer size calculation

every sample rate works now

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@174 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2007-12-06 17:30:43 +00:00
parent b01e579c2a
commit 8d546e2f07
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 );