]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
also support ReplayGain if peak is not defined
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 14 Oct 2011 17:41:41 +0000 (17:41 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 14 Oct 2011 18:52:35 +0000 (20:52 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11414 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=db154618b001c5ec3403f09b5a2142d6f972785e

snd_ogg.c

index b1f3e2a142cca96fb3f07f29f0397e12f3a8c93c..683d4213215f4496ab7bbd74a7b6e4500b496520 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -706,6 +706,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;
 }