X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=snd_mem.c;h=635bdd3ffb63407d8a27378fb83756a6b73b8c46;hb=2d2d1188be78d94770e7f73b5ddf81e168edd90b;hp=1c85951504a891264eb9669c9b9dae471c68be12;hpb=27ad2d336694ea2dc50035130bae321316e3936f;p=xonotic%2Fdarkplaces.git diff --git a/snd_mem.c b/snd_mem.c index 1c859515..635bdd3f 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -82,7 +82,7 @@ snd_buffer_t *Snd_CreateSndBuffer (const unsigned char *samples, unsigned int sa 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); @@ -326,6 +326,8 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain) 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)) { @@ -334,18 +336,18 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain) 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; + goto loaded; } else { if (ModPlug_LoadModPlugFile (namebuffer, sfx)) - return true; + goto loaded; } } @@ -358,23 +360,29 @@ qboolean S_LoadSound (sfx_t *sfx, qboolean complain) 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; + goto loaded; } 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; }