]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Added function S_IsSoundPrecached to the sound engine API. "snd_main.h" shouldn't...
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 20 Feb 2006 23:33:24 +0000 (23:33 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 20 Feb 2006 23:33:24 +0000 (23:33 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5999 d7cf8633-e32d-0410-b094-e92efae38249

cd_shared.c
snd_main.c
snd_null.c
sound.h

index 9bca5e5b150d5519e775f667062d3cf4d3c2109e..8ffaa1185ed47639422467b29331f952774f4b4c 100644 (file)
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 #include "cdaudio.h"
-#include "snd_main.h"
+#include "sound.h"
 
 #define MAXTRACKS      256
 
@@ -117,7 +117,7 @@ void CDAudio_Play (unsigned char track, qboolean looping)
 
        // Try playing a fake track (sound file) first
        sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false, false);
-       if (sfx == NULL || sfx->fetcher == NULL)
+       if (sfx == NULL || !S_IsSoundPrecached (sfx))
                sfx = S_PrecacheSound (va ("cdtracks/track%03u.wav", track), false, false);
        if (sfx != NULL)
        {
index 4030d3878dcd94a36aee7c4ce853f48ad3f7b67d..33918a36d44791e7fd8a6f5581814818f0fb24ae 100644 (file)
@@ -429,6 +429,16 @@ sfx_t *S_PrecacheSound (const char *name, qboolean complain, qboolean lock)
        return sfx;
 }
 
+/*
+==================
+S_IsSoundPrecached
+==================
+*/
+qboolean S_IsSoundPrecached (const sfx_t *sfx)
+{
+       return (sfx != NULL && sfx->fetcher != NULL);
+}
+
 /*
 ==================
 S_LockSfx
index 5ed2999f3d19ed5b74dbf035db62147b11b33825..3da10596c4638b1eb896c0e084cf2e9b2e66db36 100755 (executable)
@@ -90,6 +90,11 @@ sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean lock)
        return NULL;
 }
 
+qboolean S_IsSoundPrecached (const sfx_t *sfx)
+{
+       return false;
+}
+
 sfx_t *S_FindName (const char *name)
 {
        return NULL;
diff --git a/sound.h b/sound.h
index af734196cc8fcddfab8aee88a4aa82198a34c3fc..14d1d0540c242eb92c570e2e5eaaf0e3e5574e4f 100644 (file)
--- a/sound.h
+++ b/sound.h
@@ -66,6 +66,7 @@ void S_ExtraUpdate (void);
 
 sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean lock);
 void S_ServerSounds (char serversound [][MAX_QPATH], unsigned int numsounds);
+qboolean S_IsSoundPrecached (const sfx_t *sfx);
 
 // S_StartSound returns the channel index, or -1 if an error occurred
 int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation);