]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_modplug.c
huge audit of dprints throughout engine, all notices of successfully
[xonotic/darkplaces.git] / snd_modplug.c
index 81f00b626fe4b7d402175b5d06a7b2fe2f048b56..a3179868200f419615c7edfc7a1a9c59be2ebebe 100644 (file)
 #include "snd_main.h"
 #include "snd_modplug.h"
 
+#ifdef SND_MODPLUG_STATIC
+
+#include <libmodplug/modplug.h>
+qboolean ModPlug_OpenLibrary (void)
+{
+       return true; // statically linked
+}
+void ModPlug_CloseLibrary (void)
+{
+}
+#define modplug_dll 1
+
+#else
 // BEGIN SECTION FROM modplug.h
 
        /*
@@ -142,15 +155,7 @@ qboolean ModPlug_OpenLibrary (void)
        // Load the DLLs
        // We need to load both by hand because some OSes seem to not load
        // the modplug DLL automatically when loading the modplugFile DLL
-       if (! Sys_LoadLibrary (dllnames_modplug, &modplug_dll, modplugfuncs))
-       {
-               Sys_UnloadLibrary (&modplug_dll);
-               Con_Printf ("ModPlug support disabled\n");
-               return false;
-       }
-
-       Con_Printf ("ModPlug support enabled\n");
-       return true;
+       return Sys_LoadLibrary (dllnames_modplug, &modplug_dll, modplugfuncs);
 }
 
 
@@ -165,6 +170,7 @@ void ModPlug_CloseLibrary (void)
 {
        Sys_UnloadLibrary (&modplug_dll);
 }
+#endif
 
 
 /*
@@ -213,7 +219,7 @@ static const snd_buffer_t* ModPlug_FetchSound (void *sfxfetcher, void **chfetche
        modplug_stream_perchannel_t* per_ch = (modplug_stream_perchannel_t *)*chfetcherpointer;
        modplug_stream_persfx_t* per_sfx = (modplug_stream_persfx_t *)sfxfetcher;
        snd_buffer_t* sb;
-       int newlength, done, ret, bigendian;
+       int newlength, done, ret;
        unsigned int real_start;
        unsigned int factor;
 
@@ -327,11 +333,6 @@ static const snd_buffer_t* ModPlug_FetchSound (void *sfxfetcher, void **chfetche
                newlength = sizeof(resampling_buffer);
 
        // Decompress in the resampling_buffer
-#if BYTE_ORDER == BIG_ENDIAN
-       bigendian = 1;
-#else
-       bigendian = 0;
-#endif
        done = 0;
        while ((ret = ModPlug_Read (per_ch->mf, (char *)&resampling_buffer[done], (int)(newlength - done))) > 0)
                done += ret;
@@ -431,7 +432,8 @@ qboolean ModPlug_LoadModPlugFile (const char *filename, sfx_t *sfx)
        if (data == NULL)
                return false;
 
-       Con_DPrintf ("Loading ModPlug file \"%s\"\n", filename);
+       if (developer_loading.integer >= 2)
+               Con_Printf ("Loading ModPlug file \"%s\"\n", filename);
 
        ModPlug_GetSettings(&s);
        s.mFlags = MODPLUG_ENABLE_OVERSAMPLING | MODPLUG_ENABLE_NOISE_REDUCTION | MODPLUG_ENABLE_REVERB;
@@ -450,7 +452,8 @@ qboolean ModPlug_LoadModPlugFile (const char *filename, sfx_t *sfx)
                return false;
        }
 
-       Con_DPrintf ("\"%s\" will be streamed\n", filename);
+       if (developer_loading.integer >= 2)
+               Con_Printf ("\"%s\" will be streamed\n", filename);
        per_sfx = (modplug_stream_persfx_t *)Mem_Alloc (snd_mempool, sizeof (*per_sfx));
        strlcpy(per_sfx->name, sfx->name, sizeof(per_sfx->name));
        sfx->memsize += sizeof (*per_sfx);