X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=snd_mem.c;h=11b0a9d9a9a22a394497c627ff8293a9cb8e2824;hp=1c85951504a891264eb9669c9b9dae471c68be12;hb=0b4cff287c2e7d621f0ed198c6e00f976dbf8d31;hpb=27ad2d336694ea2dc50035130bae321316e3936f diff --git a/snd_mem.c b/snd_mem.c index 1c859515..11b0a9d9 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "snd_wav.h" #include "snd_modplug.h" +unsigned char resampling_buffer [48000 * 2 * 2]; + /* ==================== @@ -82,7 +84,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 +328,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 +338,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 +362,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; }