shithub: choc

Download patch

ref: ffbca88b7c4a766bc9a3192cf66b6b71610c431f
parent: bec0d85ca98d682c3d922d76309976a3a1359e3c
author: Fabian Greffrath <fabian@greffrath.com>
date: Sun Mar 20 04:29:58 EDT 2022

always precache sounds (#1246)

Currently, sound effects are only precached if Choco has been built
with libsamplerate support and if this is enabled at run-time.

However, I don't see a reason why we would not want to precache all
sounds if libsamplerate is either not available or disabled.
Precaching sounds only takes a second more at start-up but prevents
nasty hick-ups during playing if sounds are loaded and have their
samplerates converted over and over again.

This is inspired by the following bug report by @vanfanel:
https://github.com/fabiangreffrath/crispy-doom/issues/508#issuecomment-573915583

--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -808,8 +808,6 @@
     }
 }
 
-#ifdef HAVE_LIBSAMPLERATE
-
 // Preload all the sound effects - stops nasty ingame freezes
 
 static void I_SDL_PrecacheSounds(sfxinfo_t *sounds, int num_sounds)
@@ -817,13 +815,6 @@
     char namebuf[9];
     int i;
 
-    // Don't need to precache the sounds unless we are using libsamplerate.
-
-    if (use_libsamplerate == 0)
-    {
-	return;
-    }
-
     printf("I_SDL_PrecacheSounds: Precaching all sound effects..");
 
     for (i=0; i<num_sounds; ++i)
@@ -846,15 +837,6 @@
 
     printf("\n");
 }
-
-#else
-
-static void I_SDL_PrecacheSounds(sfxinfo_t *sounds, int num_sounds)
-{
-    // no-op
-}
-
-#endif
 
 // Load a SFX chunk into memory and ensure that it is locked.