mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 06:41:41 +00:00
- cleanup of the sound init/exit code.
Now there is only one single entry point for both, instead of previously 2 entry and 4 exit points. This also eliminates the explicit shutdown of ZMusic. Timidity++'s two buffers have been put in containers that self-destruct on shutdown and calling dumb_exit is not necessary because the only feature requiring it is not used by any code in the music library.
This commit is contained in:
parent
86ab366958
commit
d2c156224b
20 changed files with 85 additions and 204 deletions
|
@ -30,7 +30,29 @@
|
|||
namespace TimidityPlus
|
||||
{
|
||||
|
||||
static MBlockNode *free_mblock_list = NULL;
|
||||
struct MBlock
|
||||
{
|
||||
MBlockNode* free_mblock_list = NULL;
|
||||
|
||||
~MBlock()
|
||||
{
|
||||
int cnt;
|
||||
|
||||
cnt = 0;
|
||||
while (free_mblock_list)
|
||||
{
|
||||
MBlockNode* tmp;
|
||||
|
||||
tmp = free_mblock_list;
|
||||
free_mblock_list = free_mblock_list->next;
|
||||
free(tmp);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static MBlock free_list;
|
||||
|
||||
#define ADDRALIGN 8
|
||||
/* #define DEBUG */
|
||||
|
||||
|
@ -50,7 +72,7 @@ static MBlockNode *new_mblock_node(size_t n)
|
|||
return NULL;
|
||||
p->block_size = n;
|
||||
}
|
||||
else if (free_mblock_list == NULL)
|
||||
else if (free_list.free_mblock_list == NULL)
|
||||
{
|
||||
if ((p = (MBlockNode *)safe_malloc(sizeof(MBlockNode) + MIN_MBLOCK_SIZE)) == NULL)
|
||||
return NULL;
|
||||
|
@ -58,8 +80,8 @@ static MBlockNode *new_mblock_node(size_t n)
|
|||
}
|
||||
else
|
||||
{
|
||||
p = free_mblock_list;
|
||||
free_mblock_list = free_mblock_list->next;
|
||||
p = free_list.free_mblock_list;
|
||||
free_list.free_mblock_list = free_list.free_mblock_list->next;
|
||||
}
|
||||
|
||||
p->offset = 0;
|
||||
|
@ -115,8 +137,8 @@ static void reuse_mblock1(MBlockNode *p)
|
|||
free(p);
|
||||
else /* p->block_size <= MIN_MBLOCK_SIZE */
|
||||
{
|
||||
p->next = free_mblock_list;
|
||||
free_mblock_list = p;
|
||||
p->next = free_list.free_mblock_list;
|
||||
free_list.free_mblock_list = p;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,21 +171,4 @@ char *strdup_mblock(MBlockList *mblock, const char *str)
|
|||
return p;
|
||||
}
|
||||
|
||||
int free_global_mblock(void)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
cnt = 0;
|
||||
while (free_mblock_list)
|
||||
{
|
||||
MBlockNode *tmp;
|
||||
|
||||
tmp = free_mblock_list;
|
||||
free_mblock_list = free_mblock_list->next;
|
||||
free(tmp);
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
}
|
|
@ -42,6 +42,7 @@ static float newt_coeffs[58][58];
|
|||
static int sample_bounds_min, sample_bounds_max; /* min/max bounds for sample data */
|
||||
|
||||
#define DEFAULT_GAUSS_ORDER 25
|
||||
std::vector<float> gauss_table_data;
|
||||
static float *gauss_table[(1 << FRACTION_BITS)] = { 0 }; /* don't need doubles */
|
||||
static int gauss_n = DEFAULT_GAUSS_ORDER;
|
||||
|
||||
|
@ -209,7 +210,9 @@ void initialize_gauss_table(int n)
|
|||
zsin[i] = sin(i / (4 * M_PI));
|
||||
|
||||
x_inc = 1.0 / (1 << FRACTION_BITS);
|
||||
gptr = (float*)safe_realloc(gauss_table[0], (n + 1) * sizeof(float)*(1 << FRACTION_BITS));
|
||||
|
||||
gauss_table_data.resize((n + 1) * sizeof(float) * (1 << FRACTION_BITS));
|
||||
gptr = gauss_table_data.data();
|
||||
for (m = 0, x = 0.0; m < (1 << FRACTION_BITS); m++, x += x_inc)
|
||||
{
|
||||
xz = (x + n_half) / (4 * M_PI);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "zmusic/midiconfig.h"
|
||||
#include "zmusic/mididefs.h"
|
||||
|
||||
void TimidityPP_Shutdown();
|
||||
typedef void(*MidiCallback)(void *);
|
||||
|
||||
// A device that provides a WinMM-like MIDI streaming interface -------------
|
||||
|
|
|
@ -225,9 +225,3 @@ MIDIDevice *CreateTimidityPPMIDIDevice(const char *Args, int samplerate)
|
|||
return new TimidityPPMIDIDevice(samplerate);
|
||||
}
|
||||
|
||||
|
||||
void TimidityPP_Shutdown()
|
||||
{
|
||||
TimidityPlus::free_gauss_table();
|
||||
TimidityPlus::free_global_mblock();
|
||||
}
|
||||
|
|
|
@ -306,18 +306,3 @@ MusInfo *ZMusic_OpenCDSong (int track, int id)
|
|||
return info;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void TimidityPP_Shutdown();
|
||||
extern "C" void dumb_exit();
|
||||
|
||||
void ZMusic_Shutdown()
|
||||
{
|
||||
// free static data in the backends.
|
||||
TimidityPP_Shutdown();
|
||||
dumb_exit();
|
||||
}
|
||||
|
|
|
@ -159,8 +159,6 @@ void MIDIDumpWave(MIDISource* source, EMidiDevice devtype, const char* devarg, c
|
|||
MusInfo *ZMusic_OpenSong (MusicIO::FileInterface *reader, EMidiDevice device, const char *Args);
|
||||
MusInfo *ZMusic_OpenCDSong (int track, int cdid = 0);
|
||||
|
||||
void ZMusic_Shutdown();
|
||||
|
||||
class MusInfo;
|
||||
// Configuration interface. The return value specifies if a music restart is needed.
|
||||
// RealValue should be written back to the CVAR or whatever other method the client uses to store configuration state.
|
||||
|
|
|
@ -2494,7 +2494,6 @@ void D_DoomMain (void)
|
|||
|
||||
if (!batchrun) Printf ("S_Init: Setting up sound.\n");
|
||||
S_Init ();
|
||||
S_InitMusic();
|
||||
|
||||
if (!batchrun) Printf ("ST_Init: Init startup screen.\n");
|
||||
if (!restart)
|
||||
|
@ -2803,7 +2802,6 @@ void D_Cleanup()
|
|||
R_DeinitTranslationTables(); // some tables are initialized from outside the translation code.
|
||||
gameinfo.~gameinfo_t();
|
||||
new (&gameinfo) gameinfo_t; // Reset gameinfo
|
||||
S_ShutdownMusic();
|
||||
S_Shutdown(); // free all channels and delete playlist
|
||||
C_ClearAliases(); // CCMDs won't be reinitialized so these need to be deleted here
|
||||
DestroyCVarsFlagged(CVAR_MOD); // Delete any cvar left by mods
|
||||
|
|
|
@ -88,9 +88,6 @@ void I_Init(void)
|
|||
CheckCPUID(&CPU);
|
||||
CalculateCPUSpeed();
|
||||
DumpCPUInfo(&CPU);
|
||||
|
||||
atterm(I_ShutdownSound);
|
||||
I_InitSound();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,9 +97,6 @@ void I_Init (void)
|
|||
{
|
||||
CheckCPUID (&CPU);
|
||||
DumpCPUInfo (&CPU);
|
||||
|
||||
atterm(I_ShutdownSound);
|
||||
I_InitSound ();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -307,16 +307,6 @@ void I_CloseSound ()
|
|||
GSnd = NULL;
|
||||
}
|
||||
|
||||
void I_ShutdownSound()
|
||||
{
|
||||
I_ShutdownMusic(true);
|
||||
if (GSnd != NULL)
|
||||
{
|
||||
S_StopAllChannels();
|
||||
I_CloseSound();
|
||||
}
|
||||
}
|
||||
|
||||
const char *GetSampleTypeName(SampleType type)
|
||||
{
|
||||
switch(type)
|
||||
|
|
|
@ -174,7 +174,6 @@ extern bool nosfx;
|
|||
extern bool nosound;
|
||||
|
||||
void I_InitSound ();
|
||||
void I_ShutdownSound ();
|
||||
|
||||
void S_ChannelEnded(FISoundChannel *schan);
|
||||
void S_ChannelVirtualChanged(FISoundChannel *schan, bool is_virtual);
|
||||
|
|
|
@ -62,13 +62,9 @@
|
|||
|
||||
void I_InitSoundFonts();
|
||||
|
||||
extern MusPlayingInfo mus_playing;
|
||||
|
||||
EXTERN_CVAR (Int, snd_samplerate)
|
||||
EXTERN_CVAR (Int, snd_mididevice)
|
||||
|
||||
static bool MusicDown = true;
|
||||
|
||||
static bool ungzip(uint8_t *data, int size, std::vector<uint8_t> &newdata);
|
||||
|
||||
int nomusic = 0;
|
||||
|
@ -279,8 +275,6 @@ void I_InitMusic (void)
|
|||
I_InitMusicWin32 ();
|
||||
#endif // _WIN32
|
||||
|
||||
MusicDown = false;
|
||||
|
||||
Callbacks callbacks;
|
||||
|
||||
callbacks.Fluid_MessageFunc = Printf;
|
||||
|
@ -298,28 +292,6 @@ void I_InitMusic (void)
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void I_ShutdownMusic(bool onexit)
|
||||
{
|
||||
if (MusicDown)
|
||||
return;
|
||||
MusicDown = true;
|
||||
if (mus_playing.handle)
|
||||
{
|
||||
S_StopMusic (true);
|
||||
assert (mus_playing.handle == nullptr);
|
||||
}
|
||||
if (onexit)
|
||||
{
|
||||
ZMusic_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -380,7 +352,6 @@ ADD_STAT(music)
|
|||
// Common loader for the dumpers.
|
||||
//
|
||||
//==========================================================================
|
||||
extern MusPlayingInfo mus_playing;
|
||||
|
||||
static MIDISource *GetMIDISource(const char *fn)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,6 @@ struct FOptionValues;
|
|||
// MUSIC I/O
|
||||
//
|
||||
void I_InitMusic ();
|
||||
void I_ShutdownMusic (bool onexit = false);
|
||||
void I_BuildMIDIMenuList (FOptionValues *);
|
||||
|
||||
// Volume.
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "s_music.h"
|
||||
#include "zmusic/zmusic.h"
|
||||
|
||||
extern MusPlayingInfo mus_playing;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ADL Midi device
|
||||
|
|
|
@ -103,8 +103,7 @@ static void S_ActivatePlayList(bool goBack);
|
|||
|
||||
static bool MusicPaused; // whether music is paused
|
||||
MusPlayingInfo mus_playing; // music currently being played
|
||||
static FString LastSong; // last music that was played
|
||||
static FPlayList *PlayList;
|
||||
static FPlayList PlayList;
|
||||
float relative_volume = 1.f;
|
||||
float saved_relative_volume = 1.0f; // this could be used to implement an ACS FadeMusic function
|
||||
|
||||
|
@ -114,47 +113,9 @@ DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
|
|||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop);
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
void S_ShutdownMusic ();
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_Init
|
||||
//
|
||||
// Initializes sound stuff, including volume. Sets channels, SFX and
|
||||
// music volume, allocates channel buffer, and sets S_sfx lookup.
|
||||
//==========================================================================
|
||||
|
||||
void S_InitMusic ()
|
||||
{
|
||||
// no sounds are playing, and they are not paused
|
||||
mus_playing.name = "";
|
||||
LastSong = "";
|
||||
mus_playing.handle = nullptr;
|
||||
mus_playing.baseorder = 0;
|
||||
MusicPaused = false;
|
||||
atterm(S_ShutdownMusic);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_Shutdown
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_ShutdownMusic ()
|
||||
{
|
||||
if (PlayList != nullptr)
|
||||
{
|
||||
delete PlayList;
|
||||
PlayList = nullptr;
|
||||
}
|
||||
S_StopMusic (true);
|
||||
mus_playing.name = "";
|
||||
LastSong = "";
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -279,9 +240,9 @@ void S_UpdateMusic ()
|
|||
// playlist when the current song finishes.
|
||||
if (!mus_playing.handle->IsPlaying())
|
||||
{
|
||||
if (PlayList)
|
||||
if (PlayList.GetNumSongs())
|
||||
{
|
||||
PlayList->Advance();
|
||||
PlayList.Advance();
|
||||
S_ActivatePlayList(false);
|
||||
}
|
||||
else
|
||||
|
@ -331,15 +292,14 @@ void S_ActivatePlayList (bool goBack)
|
|||
{
|
||||
int startpos, pos;
|
||||
|
||||
startpos = pos = PlayList->GetPosition ();
|
||||
startpos = pos = PlayList.GetPosition ();
|
||||
S_StopMusic (true);
|
||||
while (!S_ChangeMusic (PlayList->GetSong (pos), 0, false, true))
|
||||
while (!S_ChangeMusic (PlayList.GetSong (pos), 0, false, true))
|
||||
{
|
||||
pos = goBack ? PlayList->Backup () : PlayList->Advance ();
|
||||
pos = goBack ? PlayList.Backup () : PlayList.Advance ();
|
||||
if (pos == startpos)
|
||||
{
|
||||
delete PlayList;
|
||||
PlayList = nullptr;
|
||||
PlayList.Clear();
|
||||
Printf ("Cannot play anything in the playlist.\n");
|
||||
return;
|
||||
}
|
||||
|
@ -394,7 +354,7 @@ bool S_StartMusic (const char *m_id)
|
|||
bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||
{
|
||||
if (nomusic) return false; // skip the entire procedure if music is globally disabled.
|
||||
if (!force && PlayList)
|
||||
if (!force && PlayList.GetNumSongs())
|
||||
{ // Don't change if a playlist is active
|
||||
return false;
|
||||
}
|
||||
|
@ -418,7 +378,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
|||
// Don't choke if the map doesn't have a song attached
|
||||
S_StopMusic (true);
|
||||
mus_playing.name = "";
|
||||
LastSong = "";
|
||||
mus_playing.LastSong = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -535,7 +495,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
|||
mus_playing.loop = looping;
|
||||
mus_playing.name = musicname;
|
||||
mus_playing.baseorder = order;
|
||||
LastSong = musicname;
|
||||
mus_playing.LastSong = musicname;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -561,7 +521,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
|||
mus_playing.loop = looping;
|
||||
mus_playing.name = musicname;
|
||||
mus_playing.baseorder = 0;
|
||||
LastSong = "";
|
||||
mus_playing.LastSong = "";
|
||||
|
||||
if (mus_playing.handle != 0)
|
||||
{ // play it
|
||||
|
@ -600,10 +560,10 @@ DEFINE_ACTION_FUNCTION(DObject, S_ChangeMusic)
|
|||
|
||||
void S_RestartMusic ()
|
||||
{
|
||||
if (!LastSong.IsEmpty())
|
||||
if (!mus_playing.LastSong.IsEmpty())
|
||||
{
|
||||
FString song = LastSong;
|
||||
LastSong = "";
|
||||
FString song = mus_playing.LastSong;
|
||||
mus_playing.LastSong = "";
|
||||
S_ChangeMusic (song, mus_playing.baseorder, mus_playing.loop, true);
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +640,7 @@ void S_StopMusic (bool force)
|
|||
try
|
||||
{
|
||||
// [RH] Don't stop if a playlist is active.
|
||||
if ((force || PlayList == nullptr) && !mus_playing.name.IsEmpty())
|
||||
if ((force || PlayList.GetNumSongs() == 0) && !mus_playing.name.IsEmpty())
|
||||
{
|
||||
if (mus_playing.handle != nullptr)
|
||||
{
|
||||
|
@ -690,8 +650,7 @@ void S_StopMusic (bool force)
|
|||
delete mus_playing.handle;
|
||||
mus_playing.handle = nullptr;
|
||||
}
|
||||
LastSong = mus_playing.name;
|
||||
mus_playing.name = "";
|
||||
mus_playing.LastSong = std::move(mus_playing.name);
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error& )
|
||||
|
@ -772,11 +731,7 @@ CCMD (changemus)
|
|||
{
|
||||
if (argv.argc() > 1)
|
||||
{
|
||||
if (PlayList)
|
||||
{
|
||||
delete PlayList;
|
||||
PlayList = nullptr;
|
||||
}
|
||||
PlayList.Clear();
|
||||
S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0);
|
||||
}
|
||||
else
|
||||
|
@ -806,13 +761,9 @@ CCMD (changemus)
|
|||
|
||||
CCMD (stopmus)
|
||||
{
|
||||
if (PlayList)
|
||||
{
|
||||
delete PlayList;
|
||||
PlayList = nullptr;
|
||||
}
|
||||
PlayList.Clear();
|
||||
S_StopMusic (false);
|
||||
LastSong = ""; // forget the last played song so that it won't get restarted if some volume changes occur
|
||||
mus_playing.LastSong = ""; // forget the last played song so that it won't get restarted if some volume changes occur
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -909,30 +860,25 @@ UNSAFE_CCMD (playlist)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (PlayList != nullptr)
|
||||
if (PlayList.GetNumSongs() > 0)
|
||||
{
|
||||
PlayList->ChangeList (argv[1]);
|
||||
PlayList.ChangeList (argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayList = new FPlayList (argv[1]);
|
||||
PlayList.ChangeList(argv[1]);
|
||||
}
|
||||
if (PlayList->GetNumSongs () == 0)
|
||||
{
|
||||
delete PlayList;
|
||||
PlayList = nullptr;
|
||||
}
|
||||
else
|
||||
if (PlayList.GetNumSongs () > 0)
|
||||
{
|
||||
if (argc == 3)
|
||||
{
|
||||
if (stricmp (argv[2], "shuffle") == 0)
|
||||
{
|
||||
PlayList->Shuffle ();
|
||||
PlayList.Shuffle ();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayList->SetPosition (atoi (argv[2]));
|
||||
PlayList.SetPosition (atoi (argv[2]));
|
||||
}
|
||||
}
|
||||
S_ActivatePlayList (false);
|
||||
|
@ -948,7 +894,7 @@ UNSAFE_CCMD (playlist)
|
|||
|
||||
static bool CheckForPlaylist ()
|
||||
{
|
||||
if (PlayList == nullptr)
|
||||
if (PlayList.GetNumSongs() == 0)
|
||||
{
|
||||
Printf ("No playlist is playing.\n");
|
||||
return false;
|
||||
|
@ -960,7 +906,7 @@ CCMD (playlistpos)
|
|||
{
|
||||
if (CheckForPlaylist() && argv.argc() > 1)
|
||||
{
|
||||
PlayList->SetPosition (atoi (argv[1]) - 1);
|
||||
PlayList.SetPosition (atoi (argv[1]) - 1);
|
||||
S_ActivatePlayList (false);
|
||||
}
|
||||
}
|
||||
|
@ -975,7 +921,7 @@ CCMD (playlistnext)
|
|||
{
|
||||
if (CheckForPlaylist())
|
||||
{
|
||||
PlayList->Advance ();
|
||||
PlayList.Advance ();
|
||||
S_ActivatePlayList (false);
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +936,7 @@ CCMD (playlistprev)
|
|||
{
|
||||
if (CheckForPlaylist())
|
||||
{
|
||||
PlayList->Backup ();
|
||||
PlayList.Backup ();
|
||||
S_ActivatePlayList (true);
|
||||
}
|
||||
}
|
||||
|
@ -1006,9 +952,9 @@ CCMD (playliststatus)
|
|||
if (CheckForPlaylist ())
|
||||
{
|
||||
Printf ("Song %d of %d:\n%s\n",
|
||||
PlayList->GetPosition () + 1,
|
||||
PlayList->GetNumSongs (),
|
||||
PlayList->GetSong (PlayList->GetPosition ()));
|
||||
PlayList.GetPosition () + 1,
|
||||
PlayList.GetNumSongs (),
|
||||
PlayList.GetSong (PlayList.GetPosition ()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ void S_ParseMusInfo();
|
|||
|
||||
//
|
||||
void S_InitMusic ();
|
||||
void S_ShutdownMusic ();
|
||||
void S_StartMusic ();
|
||||
|
||||
|
||||
|
@ -86,8 +85,11 @@ struct MusPlayingInfo
|
|||
MusInfo* handle;
|
||||
int baseorder;
|
||||
bool loop;
|
||||
FString LastSong; // last music that was played
|
||||
};
|
||||
|
||||
extern MusPlayingInfo mus_playing;
|
||||
|
||||
extern float relative_volume, saved_relative_volume;
|
||||
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
#include "vm.h"
|
||||
#include "g_game.h"
|
||||
#include "atterm.h"
|
||||
#include "s_music.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -308,6 +309,7 @@ void S_Init ()
|
|||
atterm(S_Shutdown);
|
||||
|
||||
// Heretic and Hexen have sound curve lookup tables. Doom does not.
|
||||
I_InitSound();
|
||||
curvelump = Wads.CheckNumForName ("SNDCURVE");
|
||||
if (curvelump >= 0)
|
||||
{
|
||||
|
@ -349,13 +351,9 @@ void S_Shutdown ()
|
|||
{
|
||||
FSoundChan *chan, *next;
|
||||
|
||||
chan = Channels;
|
||||
while (chan != NULL)
|
||||
{
|
||||
next = chan->NextChan;
|
||||
S_StopChannel(chan);
|
||||
chan = next;
|
||||
}
|
||||
S_StopMusic(true);
|
||||
mus_playing.LastSong = ""; // If this isn't reset here, the song would attempt resume at the most inpopportune time...
|
||||
S_StopAllChannels();
|
||||
|
||||
GSnd->UpdateSounds();
|
||||
for (chan = FreeChannels; chan != NULL; chan = next)
|
||||
|
@ -364,8 +362,14 @@ void S_Shutdown ()
|
|||
delete chan;
|
||||
}
|
||||
FreeChannels = NULL;
|
||||
|
||||
if (GSnd != NULL)
|
||||
{
|
||||
I_CloseSound();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_Start
|
||||
|
@ -2614,7 +2618,7 @@ CCMD (snd_reset)
|
|||
|
||||
void S_SoundReset()
|
||||
{
|
||||
I_ShutdownMusic();
|
||||
S_StopMusic(true);
|
||||
S_EvictAllChannels();
|
||||
I_CloseSound();
|
||||
I_InitSound();
|
||||
|
|
|
@ -41,11 +41,6 @@
|
|||
#include "v_text.h"
|
||||
#include "files.h"
|
||||
|
||||
FPlayList::FPlayList (const char *path)
|
||||
{
|
||||
ChangeList (path);
|
||||
}
|
||||
|
||||
FPlayList::~FPlayList ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ class FileReader;
|
|||
class FPlayList
|
||||
{
|
||||
public:
|
||||
FPlayList (const char *path);
|
||||
~FPlayList ();
|
||||
|
||||
bool ChangeList (const char *path);
|
||||
|
@ -51,11 +50,16 @@ public:
|
|||
int Backup ();
|
||||
void Shuffle ();
|
||||
const char *GetSong (int position) const;
|
||||
void Clear()
|
||||
{
|
||||
Songs.Clear();
|
||||
Position = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
static FString NextLine (FileReader &file);
|
||||
|
||||
unsigned int Position;
|
||||
unsigned int Position = 0;
|
||||
TArray<FString> Songs;
|
||||
};
|
||||
|
||||
|
|
|
@ -336,9 +336,6 @@ void I_Init()
|
|||
CheckCPUID(&CPU);
|
||||
CalculateCPUSpeed();
|
||||
DumpCPUInfo(&CPU);
|
||||
|
||||
atterm(I_ShutdownSound);
|
||||
I_InitSound ();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue