optimized timing formula a little

increases buffer size a little

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@185 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2007-12-08 14:48:14 +00:00
parent a9e35b1909
commit c2997799f7
1 changed files with 4 additions and 3 deletions

View File

@ -38,7 +38,7 @@
#include <assert.h>
#define NBUFFERS 5
#define NBUFFERS 8
//#define LOGALL
// LOGALL writes very detailed informations to vba-trace.log
@ -278,8 +278,9 @@ void OpenAL::write()
// wait until at least one buffer has finished
while( nBuffersProcessed == 0 ) {
winlog( " waiting...\n" );
// wait for 1/10 of the time one buffer needs to have finished
Sleep( soundBufferLen * 1000 / ( freq * 2 * 2 * 10 ) );
// wait for about half the time one buffer needs to finish
// unoptimized: ( sourceBufferLen * 1000 ) / ( freq * 2 * 2 ) * 1/2
Sleep( soundBufferLen / ( freq >> 7 ) );
alGetSourcei( source, AL_BUFFERS_PROCESSED, &nBuffersProcessed );
assert( AL_NO_ERROR == alGetError() );
}