ref: ecd6c015cdbf939104fb507d3fbf2e9de44e2f87
parent: 9afdc87df3f8f51d7a3900f2f92ca158b43882ef
author: Roman Fomin <rfomin@gmail.com>
date: Tue Nov 9 06:26:18 EST 2021
move declaration of win_midi_stream_opened variable
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -53,6 +53,8 @@
static boolean sdl_was_initialized = false;
+static boolean win_midi_stream_opened = false;
+
static boolean musicpaused = false;
static int current_music_volume;
@@ -157,6 +159,7 @@
if (win_midi_stream_opened)
{
I_WIN_ShutdownMusic();
+ win_midi_stream_opened = false;
}
#endif
Mix_HaltMusic();
@@ -238,7 +241,7 @@
// Don't enable it for GUS, since it handles its own volume just fine.
if (snd_musicdevice != SNDDEVICE_GUS)
{
- I_WIN_InitMusic();
+ win_midi_stream_opened = I_WIN_InitMusic();
}
#endif
@@ -290,7 +293,7 @@
return;
}
- if (handle == NULL)
+ if (handle == NULL && !win_midi_stream_opened)
{
return;
}
--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -25,12 +25,6 @@
#include "m_misc.h"
#include "midifile.h"
-// Public data
-
-boolean win_midi_stream_opened = false;
-
-// Private data
-
static HMIDISTRM hMidiStream;
static HANDLE hBufferReturnEvent;
static HANDLE hExitEvent;
@@ -352,7 +346,6 @@
hBufferReturnEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
hExitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- win_midi_stream_opened = true;
return true;
}
@@ -505,8 +498,6 @@
CloseHandle(hBufferReturnEvent);
CloseHandle(hExitEvent);
-
- win_midi_stream_opened = false;
}
#endif
--- a/src/i_winmusic.h
+++ b/src/i_winmusic.h
@@ -29,8 +29,6 @@
void I_WIN_UnRegisterSong(void);
void I_WIN_ShutdownMusic(void);
-extern boolean win_midi_stream_opened;
-
#endif
#endif