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:
parent
b01e579c2a
commit
8d546e2f07
|
@ -156,7 +156,9 @@ bool DirectSound::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
freq = 44100 / soundQuality;
|
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;
|
soundBufferTotalLen = soundBufferLen * 10;
|
||||||
|
|
||||||
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
|
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
|
||||||
|
|
|
@ -178,9 +178,9 @@ bool OpenAL::init()
|
||||||
assert( AL_NO_ERROR == alGetError() );
|
assert( AL_NO_ERROR == alGetError() );
|
||||||
|
|
||||||
freq = 44100 / soundQuality;
|
freq = 44100 / soundQuality;
|
||||||
|
// calculate the number of samples per frame first
|
||||||
soundBufferLen = freq * 2 * 2 / 60;
|
// then multiply it with the size of a sample frame (16 bit * stereo)
|
||||||
// 16bit stereo, buffer can store the sound for 1 frame in 60Hz
|
soundBufferLen = ( freq / 60 ) * 4;
|
||||||
|
|
||||||
|
|
||||||
setsystemSoundOn( true );
|
setsystemSoundOn( true );
|
||||||
|
|
Loading…
Reference in New Issue