From 62c43210bbadc9d48425b4aa2950ff9260e1458c Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 13 Jan 2005 06:40:07 +0000 Subject: [PATCH] no longer calls S_StopAllSounds when sound system restarts, and cleaned up a sound freeing loop (just nicer code) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4927 d7cf8633-e32d-0410-b094-e92efae38249 --- snd_main.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/snd_main.c b/snd_main.c index 019c59be..ede50286 100644 --- a/snd_main.c +++ b/snd_main.c @@ -31,8 +31,6 @@ void S_Play2(void); void S_SoundList(void); void S_Update_(); -void S_ClearBuffer (void); - // ======================================================================= // Internal sound data & structures @@ -143,8 +141,6 @@ void S_Startup(void) sound_started = true; Con_DPrintf("Sound sampling rate: %i\n", shm->format.speed); - - S_StopAllSounds (); } void S_Shutdown(void) @@ -260,7 +256,6 @@ sfx_t *S_FindName (const char *name) if (!snd_initialized.integer) return NULL; - // Add the default sound directory to the path if (strlen (name) >= sizeof (sfx->name)) Host_Error ("S_FindName: sound name too long (%s)", name); @@ -326,6 +321,7 @@ S_ServerSounds void S_ServerSounds (char serversound [][MAX_QPATH], unsigned int numsounds) { sfx_t *sfx; + sfx_t *sfxnext; unsigned int i; // Start the ambient sounds and make them loop @@ -366,16 +362,10 @@ void S_ServerSounds (char serversound [][MAX_QPATH], unsigned int numsounds) } // Free all unlocked sfx - sfx = known_sfx; - while (sfx != NULL) + for (sfx = known_sfx;sfx;sfx = sfxnext) { - sfx_t* crtsfx; - - // We may lose the "next" pointer after S_FreeSfx - crtsfx = sfx; - sfx = sfx->next; - - S_FreeSfx (crtsfx, false); + sfxnext = sfx->next; + S_FreeSfx (sfx); } } -- 2.39.2