#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"
+
+
void S_Play(void);
void S_PlayVol(void);
void S_Play2(void);
int snd_blocked = 0;
static qboolean snd_ambient = 1;
-//qboolean snd_initialized = false;
cvar_t snd_initialized = { CVAR_READONLY, "snd_initialized", "0"};
// pointer should go away
total_channels = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS; // no statics
memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
+
+ OGG_OpenLibrary ();
}
/*
=========
-S_IsCached
+S_GetCached
=========
*/
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
int ch_idx;
int skip;
- if (!sound_started || !sfx || nosound.integer)
+ if (!sound_started || !sfx || !sfx->sfxcache || nosound.integer)
return;
vol = fvol*255;
target_chan->entchannel = entchannel;
SND_Spatialize(target_chan, false);
- if (!target_chan->leftvol && !target_chan->rightvol)
- return; // not audible at all
+ // LordHavoc: spawn the sound anyway because the player might teleport to it
+ //if (!target_chan->leftvol && !target_chan->rightvol)
+ // return; // not audible at all
// new channel
sc = S_LoadSound (sfx, true);
reps = 0;
- while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, &pData, &dwSize, NULL, NULL, 0)) != DS_OK)
+ while ((hresult = pDSBuf->lpVtbl->Lock(pDSBuf, 0, gSndBufSize, (LPVOID*)&pData, &dwSize, NULL, NULL, 0)) != DS_OK)
{
if (hresult != DSERR_BUFFERLOST)
{
// 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
oldsamplepos = samplepos;
soundtime = buffers*fullsamples + samplepos/shm->channels;
-#endif
}
void IN_Accumulate (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)
}
-void S_ClearPrecache (void)
-{
-}
-
-
-void S_BeginPrecaching (void)
-{
-}
-
-
-void S_EndPrecaching (void)
-{
-}
-
-
#define RAWSAMPLESBUFFER 32768
short s_rawsamplesbuffer[RAWSAMPLESBUFFER * 2];
int s_rawsamplesbuffer_start;