]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
try using waveOutGetPosition instead of block counting (revert or #ifdef this if...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Mar 2008 21:24:27 +0000 (21:24 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Mar 2008 21:24:27 +0000 (21:24 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8200 d7cf8633-e32d-0410-b094-e92efae38249

snd_win.c

index 91fc49135b9b68714e92828142e3615848095eef..4206cdaf6efc9cc74a4779d8ba58c801aed5e941 100644 (file)
--- 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;