#include "snd_main.h"
#include "snd_ogg.h"
#include "snd_wav.h"
-#include "snd_modplug.h"
/*
size_t newsampleframes, memsize;
snd_buffer_t* sb;
- newsampleframes = (size_t) ((double)sampleframes * (double)sb_speed / (double)in_format->speed);
+ newsampleframes = (size_t) ceil((double)sampleframes * (double)sb_speed / (double)in_format->speed);
memsize = newsampleframes * in_format->channels * in_format->width;
memsize += sizeof (*sb) - sizeof (sb->samples);
sb->format.channels = in_format->channels;
sb->format.width = in_format->width;
sb->format.speed = sb_speed;
- sb->maxframes = newsampleframes;
+ sb->maxframes = (unsigned int)newsampleframes;
sb->nbframes = 0;
if (!Snd_AppendToSndBuffer (sb, samples, sampleframes, in_format))
}
}
- sb->nbframes += outcount;
+ sb->nbframes += (unsigned int)outcount;
return true;
}
if (developer_loading.integer)
Con_Printf("loading sound %s\n", sfx->name);
+ SCR_PushLoadingScreen(true, sfx->name, 1);
+
// LordHavoc: if the sound filename does not begin with sound/, try adding it
if (strncasecmp(sfx->name, "sound/", 6))
{
if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".wav"))
{
if (S_LoadWavFile (namebuffer, sfx))
- return true;
+ goto loaded;
memcpy (namebuffer + len - 3, "ogg", 4);
}
if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".ogg"))
{
if (OGG_LoadVorbisFile (namebuffer, sfx))
- return true;
- }
- else
- {
- if (ModPlug_LoadModPlugFile (namebuffer, sfx))
- return true;
+ goto loaded;
}
}
if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".wav"))
{
if (S_LoadWavFile (namebuffer, sfx))
- return true;
+ goto loaded;
memcpy (namebuffer + len - 3, "ogg", 4);
}
if (len >= 4 && !strcasecmp (namebuffer + len - 4, ".ogg"))
{
if (OGG_LoadVorbisFile (namebuffer, sfx))
- return true;
- }
- else
- {
- if (ModPlug_LoadModPlugFile (namebuffer, sfx))
- return true;
+ goto loaded;
}
// Can't load the sound!
sfx->flags |= SFXFLAG_FILEMISSING;
if (complain)
Con_DPrintf("failed to load sound \"%s\"\n", sfx->name);
+
+ SCR_PopLoadingScreen(false);
return false;
+
+loaded:
+ SCR_PopLoadingScreen(false);
+ return true;
}