Skip to content
Permalink
Browse files

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

  • Loading branch information...
coelckers committed Aug 23, 2019
1 parent 2440d72 commit 48f2105cd15d40416f564b7f0b4a0e5a49b406d2
Showing with 43 additions and 31 deletions.
  1. +1 −30 src/sound/backend/i_sound.cpp
  2. +1 −1 src/sound/backend/oalsound.cpp
  3. +39 −0 src/sound/s_sound.cpp
  4. +2 −0 src/sound/s_sound.h
@@ -300,10 +300,7 @@ void I_InitSound ()
void I_CloseSound ()
{
// Free all loaded samples
for (unsigned i = 0; i < S_sfx.Size(); i++)
{
S_UnloadSound(&S_sfx[i]);
}
S_UnloadAllSounds();

delete GSnd;
GSnd = NULL;
@@ -339,32 +336,6 @@ const char *GetChannelConfigName(enum ChannelConfig chan)
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 ()
{
}
@@ -2243,7 +2243,7 @@ void OpenALSoundRenderer::UpdateSounds()
if(connected == ALC_FALSE)
{
Printf("Sound device disconnected; restarting...\n");
AddCommandString("snd_reset");
S_SoundReset();
return;
}
}
@@ -119,6 +119,7 @@ enum
extern float S_GetMusicVolume (const char *music);

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
void I_CloseSound();

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

@@ -2592,3 +2593,41 @@ DEFINE_ACTION_FUNCTION(DObject, S_ResumeSound)
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 ();
}
@@ -373,5 +373,7 @@ void S_SetEnvironment (const ReverbContainer *settings);
ReverbContainer *S_FindEnvironment (const char *name);
ReverbContainer *S_FindEnvironment (int id);
void S_AddEnvironment (ReverbContainer *settings);
void S_UnloadAllSounds();
void S_SoundReset();

#endif

0 comments on commit 48f2105

Please sign in to comment.
You can’t perform that action at this time.