- moved all shutdown handling for sound related resources to I_ShutdownSound instead of registering separate atterm handlers.

This commit is contained in:
Christoph Oelckers 2018-12-19 09:39:06 +01:00
parent bcff04e76f
commit 1a3df8dfba
5 changed files with 3 additions and 18 deletions

View file

@ -73,6 +73,7 @@ enum EMIDIType
extern int MUSHeaderSearch(const uint8_t *head, int len); extern int MUSHeaderSearch(const uint8_t *head, int len);
void I_InitSoundFonts(); void I_InitSoundFonts();
extern "C" void dumb_exit();
EXTERN_CVAR (Int, snd_samplerate) EXTERN_CVAR (Int, snd_samplerate)
EXTERN_CVAR (Int, snd_mididevice) EXTERN_CVAR (Int, snd_mididevice)
@ -127,8 +128,6 @@ CUSTOM_CVAR (Float, snd_musicvolume, 0.5f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
void I_InitMusic (void) void I_InitMusic (void)
{ {
static bool setatterm = false;
I_InitSoundFonts(); I_InitSoundFonts();
snd_musicvolume.Callback (); snd_musicvolume.Callback ();
@ -139,12 +138,6 @@ void I_InitMusic (void)
I_InitMusicWin32 (); I_InitMusicWin32 ();
#endif // _WIN32 #endif // _WIN32
if (!setatterm)
{
setatterm = true;
atterm (I_ShutdownMusicExit);
}
MusicDown = false; MusicDown = false;
} }
@ -170,15 +163,10 @@ void I_ShutdownMusic(bool onexit)
{ {
WildMidi_Shutdown(); WildMidi_Shutdown();
TimidityPP_Shutdown(); TimidityPP_Shutdown();
dumb_exit();
} }
} }
void I_ShutdownMusicExit()
{
I_ShutdownMusic(true);
}
//========================================================================== //==========================================================================
// //
// //

View file

@ -45,7 +45,6 @@ struct FOptionValues;
// //
void I_InitMusic (); void I_InitMusic ();
void I_ShutdownMusic (bool onexit = false); void I_ShutdownMusic (bool onexit = false);
void I_ShutdownMusicExit ();
void I_BuildMIDIMenuList (FOptionValues *); void I_BuildMIDIMenuList (FOptionValues *);
void I_UpdateMusic (); void I_UpdateMusic ();

View file

@ -287,6 +287,7 @@ void I_CloseSound ()
void I_ShutdownSound() void I_ShutdownSound()
{ {
I_ShutdownMusic(true);
if (GSnd != NULL) if (GSnd != NULL)
{ {
S_StopAllChannels(); S_StopAllChannels();

View file

@ -774,8 +774,6 @@ MusInfo *MOD_OpenSong(FileReader &reader)
bool is_it = false; bool is_it = false;
bool is_dos = true; bool is_dos = true;
atterm(dumb_exit);
int size = (int)reader.GetLength(); int size = (int)reader.GetLength();
auto fpos = reader.Tell(); auto fpos = reader.Tell();

View file

@ -247,7 +247,6 @@ void initialize_resampler_coeffs(void)
static bool done = false; static bool done = false;
if (done) return; if (done) return;
done = true; done = true;
// atterm(free_gauss_table);
initialize_newton_coeffs(); initialize_newton_coeffs();
initialize_gauss_table(gauss_n); initialize_gauss_table(gauss_n);