]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_win.c
Solaris compile fixes
[xonotic/darkplaces.git] / snd_win.c
index 4206cdaf6efc9cc74a4779d8ba58c801aed5e941..fff1e3aaf3c8a7326d9ef37eec78d51405892ce3 100644 (file)
--- a/snd_win.c
+++ b/snd_win.c
@@ -87,9 +87,9 @@ extern HWND mainwindow;
 HRESULT (WINAPI *pDirectSoundCreate)(GUID FAR *lpGUID, LPDIRECTSOUND FAR *lplpDS, IUnknown FAR *pUnkOuter);
 #endif
 
-// Wave output: 64KB in 64 buffers of 1KB
-// (64KB is > 1 sec at 16-bit 22050 Hz mono, and is 1/3 sec at 16-bit 44100 Hz stereo)
-#define        WAV_BUFFERS             64
+// Wave output: how much buffer time, and how many partitions in that time
+#define WAV_BUFFERTIME 0.125
+#define        WAV_BUFFERS             16
 #define        WAV_MASK                (WAV_BUFFERS - 1)
 static unsigned int wav_buffer_size;
 
@@ -458,7 +458,7 @@ static qboolean SndSys_InitMmsystem (const snd_format_t* requested)
                }
        }
 
-       wav_buffer_size = (requested->speed / 2 / WAV_BUFFERS) * requested->channels * requested->width;
+       wav_buffer_size = ((int)(requested->speed * WAV_BUFFERTIME) / WAV_BUFFERS) * requested->channels * requested->width;
 
        /*
         * Allocate and lock memory for the waveform data. The memory
@@ -737,8 +737,6 @@ 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;
 
@@ -759,7 +757,6 @@ unsigned int SndSys_GetSoundTime (void)
 
        if (wav_init)
        {
-               /*
                // Find which sound blocks have completed
                for (;;)
                {
@@ -776,12 +773,20 @@ unsigned int SndSys_GetSoundTime (void)
                }
 
                return (snd_completed * wav_buffer_size) / factor;
-               */
+
+               /*
+                * S_PaintAndSubmit: WARNING: newsoundtime (soundtime (275 < 134217707)
+                * apparently this sound time wraps quite early?
+               {
+               MMRESULT res;
+               MMTIME mmtime;
 
                mmtime.wType = TIME_SAMPLES;
                res = waveOutGetPosition(hWaveOut, &mmtime, sizeof(mmtime));
                if(res == MMSYSERR_NOERROR)
                        return mmtime.u.sample;
+               }
+               */
        }
 
        return 0;