]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_ogg.c
sv_user: Remove commented out dead code.
[xonotic/darkplaces.git] / snd_ogg.c
index b1f3e2a142cca96fb3f07f29f0397e12f3a8c93c..79c1b035bba41a564c403bff536f461658a88264 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
 */
 
 
-#include "quakedef.h"
+#include "darkplaces.h"
 #include "snd_main.h"
 #include "snd_ogg.h"
 #include "snd_wav.h"
+#include "sound.h"
 
 #ifdef LINK_TO_LIBVORBIS
 #define OV_EXCLUDE_STATIC_CALLBACKS
@@ -41,7 +42,7 @@
 #define qov_read ov_read
 #define qvorbis_comment_query vorbis_comment_query
 
-qboolean OGG_OpenLibrary (void) {return true;}
+qbool OGG_OpenLibrary (void) {return true;}
 void OGG_CloseLibrary (void) {}
 #else
 
@@ -269,7 +270,7 @@ OGG_OpenLibrary
 Try to load the VorbisFile DLL
 ====================
 */
-qboolean OGG_OpenLibrary (void)
+qbool OGG_OpenLibrary (void)
 {
        const char* dllnames_vo [] =
        {
@@ -305,7 +306,7 @@ qboolean OGG_OpenLibrary (void)
                return true;
 
 // COMMANDLINEOPTION: Sound: -novorbis disables ogg vorbis sound support
-       if (COM_CheckParm("-novorbis"))
+       if (Sys_CheckParm("-novorbis"))
                return false;
 
        // Load the DLLs
@@ -472,7 +473,7 @@ static void OGG_GetSamplesFloat (channel_t *ch, sfx_t *sfx, int firstsampleframe
                ret = qov_pcm_seek(&per_ch->vf, (ogg_int64_t)firstsampleframe);
                if (ret != 0)
                {
-                       // LordHavoc: we can't Con_Printf here, not thread safe...
+                       // LadyHavoc: we can't Con_Printf here, not thread safe...
                        //Con_Printf("OGG_FetchSound: qov_pcm_seek(..., %d) returned %d\n", firstsampleframe, ret);
                        return;
                }
@@ -600,7 +601,7 @@ OGG_LoadVorbisFile
 Load an Ogg Vorbis file into memory
 ====================
 */
-qboolean OGG_LoadVorbisFile(const char *filename, sfx_t *sfx)
+qbool OGG_LoadVorbisFile(const char *filename, sfx_t *sfx)
 {
        unsigned char *data;
        fs_offset_t filesize;
@@ -706,6 +707,13 @@ qboolean OGG_LoadVorbisFile(const char *filename, sfx_t *sfx)
                if (developer_loading.integer >= 2)
                        Con_Printf ("Ogg sound file \"%s\" uses ReplayGain (gain %f, peak %f)\n", filename, sfx->volume_mult, sfx->volume_peak);
        }
+       else if(gaindb != 0)
+       {
+               sfx->volume_mult = min(1.0f / peak, exp(gaindb * 0.05f * log(10.0f)));
+               sfx->volume_peak = 1.0; // if peak is not defined, we won't trust it
+               if (developer_loading.integer >= 2)
+                       Con_Printf ("Ogg sound file \"%s\" uses ReplayGain (gain %f, peak not defined and assumed to be %f)\n", filename, sfx->volume_mult, sfx->volume_peak);
+       }
 
        return true;
 }