From d47d18998b5b72c9e8567f81b8496ada140b8b57 Mon Sep 17 00:00:00 2001
From: mazmazz <mar.marcoz@outlook.com>
Date: Wed, 15 Aug 2018 01:43:16 -0400
Subject: [PATCH] Add S_MidiPlaying and S_MusicPlaying via I_MIDIPlaying and
 I_MusicPlaying

# Conflicts:
#	src/sdl12/mixer_sound.c
---
 src/i_sound.h         | 12 ++++++++++++
 src/s_sound.c         | 10 ++++++++++
 src/s_sound.h         |  6 ++++++
 src/sdl/mixer_sound.c | 10 ++++++++++
 src/win32/win_snd.c   | 10 ++++++++++
 5 files changed, 48 insertions(+)

diff --git a/src/i_sound.h b/src/i_sound.h
index 14eb6c2157..59d9c43829 100644
--- a/src/i_sound.h
+++ b/src/i_sound.h
@@ -132,6 +132,18 @@ void I_PauseSong(INT32 handle);
 */
 void I_ResumeSong(INT32 handle);
 
+/**	\brief Get MIDI music status
+
+	\return boolean
+*/
+boolean I_MIDIPlaying(void);
+
+/**	\brief Get general music status
+
+	\return boolean
+*/
+boolean I_MusicPlaying(void);
+
 //
 //  MIDI I/O
 //
diff --git a/src/s_sound.c b/src/s_sound.c
index 6e4f9494da..092f1c7797 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -1575,3 +1575,13 @@ void S_ResumeAudio(void)
 	// resume cd music
 	I_ResumeCD();
 }
+
+boolean S_MIDIPlaying(void)
+{
+	return I_MIDIPlaying();
+}
+
+boolean S_MusicPlaying(void)
+{
+	return I_MusicPlaying();
+}
diff --git a/src/s_sound.h b/src/s_sound.h
index bb7cad0712..a463b85810 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -148,6 +148,12 @@ void S_StopMusic(void);
 void S_PauseAudio(void);
 void S_ResumeAudio(void);
 
+// Gets MIDI music status
+boolean S_MIDIPlaying(void);
+
+// Gets general music status
+boolean S_MusicPlaying(void);
+
 //
 // Updates music & sounds
 //
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index 2e9a91ef92..d94093f81a 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -497,6 +497,16 @@ void I_ResumeSong(INT32 handle)
 	songpaused = false;
 }
 
+boolean I_MIDIPlaying(void)
+{
+	return midimode && music;
+}
+
+boolean I_MusicPlaying(void)
+{
+	return (boolean)music;
+}
+
 //
 // Digital Music
 //
diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c
index e125c721db..7b220f12bd 100644
--- a/src/win32/win_snd.c
+++ b/src/win32/win_snd.c
@@ -468,6 +468,16 @@ void I_ResumeSong(INT32 handle)
 		FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false));
 }
 
+boolean I_MIDIPlaying(void)
+{
+	return midimode && music_stream;
+}
+
+boolean I_MusicPlaying(void)
+{
+	return (boolean)music_stream;
+}
+
 void I_InitDigMusic(void)
 {
 }
-- 
GitLab