- moved a few CCMDs from i_sound.cpp to s_sound.cpp.

This commit is contained in:
Christoph Oelckers 2019-08-23 21:57:56 +02:00
parent 2440d72f40
commit 48f2105cd1
4 changed files with 43 additions and 31 deletions

View file

@ -300,10 +300,7 @@ void I_InitSound ()
void I_CloseSound () void I_CloseSound ()
{ {
// Free all loaded samples // Free all loaded samples
for (unsigned i = 0; i < S_sfx.Size(); i++) S_UnloadAllSounds();
{
S_UnloadSound(&S_sfx[i]);
}
delete GSnd; delete GSnd;
GSnd = NULL; GSnd = NULL;
@ -339,32 +336,6 @@ const char *GetChannelConfigName(enum ChannelConfig chan)
return "(invalid channel config)"; return "(invalid channel config)";
} }
CCMD (snd_status)
{
GSnd->PrintStatus ();
}
CCMD (snd_reset)
{
I_ShutdownMusic();
S_EvictAllChannels();
I_CloseSound();
I_InitSound();
S_RestartMusic();
S_RestoreEvictedChannels();
}
CCMD (snd_listdrivers)
{
GSnd->PrintDriversList ();
}
ADD_STAT (sound)
{
return GSnd->GatherStats ();
}
SoundRenderer::SoundRenderer () SoundRenderer::SoundRenderer ()
{ {
} }

View file

@ -2243,7 +2243,7 @@ void OpenALSoundRenderer::UpdateSounds()
if(connected == ALC_FALSE) if(connected == ALC_FALSE)
{ {
Printf("Sound device disconnected; restarting...\n"); Printf("Sound device disconnected; restarting...\n");
AddCommandString("snd_reset"); S_SoundReset();
return; return;
} }
} }

View file

@ -119,6 +119,7 @@ enum
extern float S_GetMusicVolume (const char *music); extern float S_GetMusicVolume (const char *music);
// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
void I_CloseSound();
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -2592,3 +2593,41 @@ DEFINE_ACTION_FUNCTION(DObject, S_ResumeSound)
return 0; return 0;
} }
void S_UnloadAllSounds()
{
for (unsigned i = 0; i < S_sfx.Size(); i++)
{
S_UnloadSound(&S_sfx[i]);
}
}
CCMD (snd_status)
{
GSnd->PrintStatus ();
}
CCMD (snd_reset)
{
S_SoundReset();
}
void S_SoundReset()
{
I_ShutdownMusic();
S_EvictAllChannels();
I_CloseSound();
I_InitSound();
S_RestartMusic();
S_RestoreEvictedChannels();
}
CCMD (snd_listdrivers)
{
GSnd->PrintDriversList ();
}
ADD_STAT (sound)
{
return GSnd->GatherStats ();
}

View file

@ -373,5 +373,7 @@ void S_SetEnvironment (const ReverbContainer *settings);
ReverbContainer *S_FindEnvironment (const char *name); ReverbContainer *S_FindEnvironment (const char *name);
ReverbContainer *S_FindEnvironment (int id); ReverbContainer *S_FindEnvironment (int id);
void S_AddEnvironment (ReverbContainer *settings); void S_AddEnvironment (ReverbContainer *settings);
void S_UnloadAllSounds();
void S_SoundReset();
#endif #endif