]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_ogg.c
prevent creation of a cvar named "", as that breaks cvar()
[xonotic/darkplaces.git] / snd_ogg.c
index 4c210d21fe10865ee28aa2e88cbed87b483730c0..17ddc1b833d8537696a36fe26066dc4327bc61dc 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -505,7 +505,7 @@ static const snd_buffer_t* OGG_FetchSound (void *sfxfetcher, void **chfetcherpoi
                }
                sb->nbframes = 0;
 
-               real_start = (float)ogg_start / per_sfx->format.speed * snd_renderbuffer->format.speed;
+               real_start = (unsigned int) ((float)ogg_start / per_sfx->format.speed * snd_renderbuffer->format.speed);
                if (*start - real_start + nbsampleframes > sb->maxframes)
                {
                        Con_Printf ("OGG_FetchSound: stream buffer too small after seek (%u sample frames required)\n",
@@ -645,11 +645,11 @@ static void OGG_DecodeTags(vorbis_comment *vc, unsigned int *start, unsigned int
 
        if(startcomment)
        {
-               *start = bound(0, atof(startcomment) * samplesfactor, numsamples);
+               *start = (unsigned int) bound(0, atof(startcomment) * samplesfactor, numsamples);
                if(endcomment)
-                       *length = bound(0, atof(endcomment) * samplesfactor, numsamples);
+                       *length = (unsigned int) bound(0, atof(endcomment) * samplesfactor, numsamples);
                else if(lengthcomment)
-                       *length = bound(0, *start + atof(lengthcomment) * samplesfactor, numsamples);
+                       *length = (unsigned int) bound(0, *start + atof(lengthcomment) * samplesfactor, numsamples);
        }
 }
 
@@ -792,7 +792,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *sfx)
 
        if(peak)
        {
-               sfx->volume_mult = min(1 / peak, exp(gaindb * 0.05 * log(10)));
+               sfx->volume_mult = min(1.0f / peak, exp(gaindb * 0.05f * log(10.0f)));
                sfx->volume_peak = peak;
                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);