git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4895
d7cf8633-e32d-0410-b094-
e92efae38249
Host_SaveConfig_f();
CDAudio_Shutdown ();
Host_SaveConfig_f();
CDAudio_Shutdown ();
NetConn_Shutdown ();
if (cls.state != ca_dedicated)
NetConn_Shutdown ();
if (cls.state != ca_dedicated)
// Functions
// ====================================================================
// Functions
// ====================================================================
+void S_FreeSfx (sfx_t *sfx, qboolean force);
+
+
void S_SoundInfo_f(void)
{
if (!sound_started)
void S_SoundInfo_f(void)
{
if (!sound_started)
+/*
+================
+S_Terminate
+
+Shutdown and free all resources
+================
+*/
+void S_Terminate (void)
+{
+ S_Shutdown ();
+ OGG_CloseLibrary ();
+
+ // Free all SFXs
+ while (known_sfx != NULL)
+ S_FreeSfx (known_sfx, true);
+
+ Cvar_SetValueQuick (&snd_initialized, false);
+ Mem_FreePool (&snd_mempool);
+}
+
+
// =======================================================================
// Load a sound
// =======================================================================
// =======================================================================
// Load a sound
// =======================================================================
-void S_FreeSfx (sfx_t *sfx)
+void S_FreeSfx (sfx_t *sfx, qboolean force)
- // Never free a locked sfx
- if (sfx->locks > 0 || (sfx->flags & SFXFLAG_PERMANENTLOCK))
+ // Never free a locked sfx unless forced
+ if (!force && (sfx->locks > 0 || (sfx->flags & SFXFLAG_PERMANENTLOCK)))
return;
Con_DPrintf ("S_FreeSfx: freeing %s\n", sfx->name);
return;
Con_DPrintf ("S_FreeSfx: freeing %s\n", sfx->name);
crtsfx = sfx;
sfx = sfx->next;
crtsfx = sfx;
sfx = sfx->next;
+ S_FreeSfx (crtsfx, false);
// Free the sfx if the file didn't exist
if (ch_ind < 0)
// Free the sfx if the file didn't exist
if (ch_ind < 0)
+ S_FreeSfx (sfx, false);
else
channels[ch_ind].flags |= CHANNELFLAG_LOCALSOUND;
}
else
channels[ch_ind].flags |= CHANNELFLAG_LOCALSOUND;
}
Cvar_RegisterVariable(&snd_initialized);
}
Cvar_RegisterVariable(&snd_initialized);
}
+void S_Terminate (void)
+{
+}
+
void S_Startup (void)
{
}
void S_Startup (void)
{
}
// ====================================================================
void S_Init (void);
// ====================================================================
void S_Init (void);
+void S_Terminate (void);
+
void S_Startup (void);
void S_Shutdown (void);
void S_Startup (void);
void S_Shutdown (void);