]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_dma.c
Added a couple of function skeletons for the automatic unloading of unused sounds...
[xonotic/darkplaces.git] / snd_dma.c
index 9035546ae72f7f5e18dbb6c8b9e9b32b4843813c..0c785bcc579cc629eb721be273399c49deb19c15 100644 (file)
--- a/snd_dma.c
+++ b/snd_dma.c
@@ -22,7 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "quakedef.h"
 
 #ifdef _WIN32
-#include "winquake.h"
+#include <windows.h>
+#include <dsound.h>
+extern DWORD gSndBufSize;
+extern LPDIRECTSOUND pDS;
+extern LPDIRECTSOUNDBUFFER pDSBuf;
 #endif
 
 #include "ogg.h"
@@ -271,7 +275,7 @@ void S_Init(void)
 
 /*
 =========
-S_IsCached
+S_GetCached
 
 =========
 */
@@ -339,8 +343,34 @@ S_TouchSound
 void S_TouchSound (char *name)
 {
        S_FindName(name);
+       // TODO: set the "used" flag for this sound
 }
 
+
+/*
+==================
+S_ClearUsed
+
+==================
+*/
+void S_ClearUsed (void)
+{
+       // TODO: reset the "used" flag of all precached sounds
+}
+
+
+/*
+==================
+S_PurgeUnused
+
+==================
+*/
+void S_PurgeUnused (void)
+{
+       // TODO: free all precached sounds without the "used" flag
+}
+
+
 /*
 ==================
 S_PrecacheSound
@@ -817,12 +847,8 @@ void GetSoundtime(void)
 
 // it is possible to miscount buffers if it has wrapped twice between
 // calls to S_Update.  Oh well.
-#ifdef __sun__
-       soundtime = SNDDMA_GetSamples();
-#else
        samplepos = SNDDMA_GetDMAPos();
 
-
        if (samplepos < oldsamplepos)
        {
                buffers++;                                      // buffer wrapped
@@ -837,7 +863,6 @@ void GetSoundtime(void)
        oldsamplepos = samplepos;
 
        soundtime = buffers*fullsamples + samplepos/shm->channels;
-#endif
 }
 
 void IN_Accumulate (void);
@@ -882,7 +907,7 @@ void S_Update_(void)
 
                if (pDSBuf)
                {
-                       if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DD_OK)
+                       if (pDSBuf->lpVtbl->GetStatus (pDSBuf, &dwStatus) != DS_OK)
                                Con_Printf ("Couldn't get sound buffer status\n");
 
                        if (dwStatus & DSBSTATUS_BUFFERLOST)
@@ -989,21 +1014,6 @@ void S_LocalSound (char *sound)
 }
 
 
-void S_ClearPrecache (void)
-{
-}
-
-
-void S_BeginPrecaching (void)
-{
-}
-
-
-void S_EndPrecaching (void)
-{
-}
-
-
 #define RAWSAMPLESBUFFER 32768
 short s_rawsamplesbuffer[RAWSAMPLESBUFFER * 2];
 int s_rawsamplesbuffer_start;