From: divverent Date: Sat, 8 Mar 2008 21:24:27 +0000 (+0000) Subject: try using waveOutGetPosition instead of block counting (revert or #ifdef this if... X-Git-Tag: xonotic-v0.1.0preview~2326 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a7738dc57ddeafb09fd5a57123498b349cee0c97;p=xonotic%2Fdarkplaces.git try using waveOutGetPosition instead of block counting (revert or #ifdef this if it breaks anything) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8200 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/snd_win.c b/snd_win.c index 91fc4913..4206cdaf 100644 --- a/snd_win.c +++ b/snd_win.c @@ -711,6 +711,8 @@ void SndSys_Submit (void) { if(developer.integer >= 1000) Con_Print("waveOutWrite failed (too much sound data)\n"); + //h->dwFlags |= WHDR_DONE; + //snd_sent++; } else { @@ -735,6 +737,8 @@ Returns the number of sample frames consumed since the sound started unsigned int SndSys_GetSoundTime (void) { unsigned int factor; + MMRESULT res; + MMTIME mmtime; factor = snd_renderbuffer->format.width * snd_renderbuffer->format.channels; @@ -755,6 +759,7 @@ unsigned int SndSys_GetSoundTime (void) if (wav_init) { + /* // Find which sound blocks have completed for (;;) { @@ -771,6 +776,12 @@ unsigned int SndSys_GetSoundTime (void) } return (snd_completed * wav_buffer_size) / factor; + */ + + mmtime.wType = TIME_SAMPLES; + res = waveOutGetPosition(hWaveOut, &mmtime, sizeof(mmtime)); + if(res == MMSYSERR_NOERROR) + return mmtime.u.sample; } return 0;