diff --git a/src/android/i_sound.c b/src/android/i_sound.c
index 1011dbb6a5580f2325355b93ffa4d743b2e64c01..c3fc038e51112380d658a07f704d30554a6592e8 100644
--- a/src/android/i_sound.c
+++ b/src/android/i_sound.c
@@ -60,6 +60,11 @@ void I_SetSfxVolume(INT32 volume)
 //
 UINT8 music_started = 0;
 
+musictype_t I_GetMusicType(void)
+{
+	return MU_NONE;
+}
+
 void I_InitMusic(void){}
 
 void I_ShutdownMusic(void){}
@@ -99,12 +104,12 @@ boolean I_PlaySong(boolean looping)
         return false;
 }
 
-void I_StopSong(INT32 handle)
+void I_StopSong(void)
 {
         (void)handle;
 }
 
-void I_UnRegisterSong(INT32 handle)
+void I_UnloadSong(void)
 {
         (void)handle;
 }
@@ -115,19 +120,6 @@ void I_UnRegisterSong(INT32 handle)
 
 UINT8 digmusic_started = 0;
 
-void I_InitDigMusic(void){}
-
-void I_ShutdownDigMusic(void){}
-
-boolean I_StartDigSong(const char *musicname, INT32 looping)
-{
-        (void)musicname;
-        (void)looping;
-        return false;
-}
-
-void I_StopDigSong(void){}
-
 void I_SetDigMusicVolume(INT32 volume)
 {
         (void)volume;
@@ -137,4 +129,4 @@ boolean I_SetSongSpeed(float speed)
 {
         (void)speed;
         return false;
-}
+}
\ No newline at end of file
diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c
index 105e8d67a0fbb2bb3ebd1f09a6ce47f90f48dd16..4c8ceb20c5d66260d17ba2d45f391eaa1ba973ff 100644
--- a/src/djgppdos/i_sound.c
+++ b/src/djgppdos/i_sound.c
@@ -322,6 +322,13 @@ static int      islooping=0;
 static int      musicdies=-1;
 UINT8           music_started=0;
 
+musictype_t I_GetMusicType(void)
+{
+	if (currsong)
+		return MU_MID;
+	else
+		return MU_NONE;
+}
 
 /* load_midi_mem:
  *  Loads a standard MIDI file from memory, returning a pointer to
@@ -389,7 +396,7 @@ static MIDI *load_midi_mem(char *mempointer,int *e)
 	return midi;
 }
 
-void I_InitMIDIMusic(void)
+void I_InitMusic(void)
 {
 	if (nomidimusic)
 		return;
@@ -398,12 +405,12 @@ void I_InitMIDIMusic(void)
 	music_started = true;
 }
 
-void I_ShutdownMIDIMusic(void)
+void I_ShutdownMusic(void)
 {
 	if ( !music_started )
 		return;
 
-	I_StopSong(1);
+	I_StopSong();
 
 	music_started=false;
 }
@@ -439,7 +446,7 @@ void I_ResumeSong (INT32 handle)
 	midi_resume();
 }
 
-void I_StopSong(INT32 handle)
+void I_StopSong(void)
 {
 	handle = 0;
 	if (nomidimusic)
@@ -462,7 +469,7 @@ int I_QrySongPlaying(int handle)
 }
 #endif
 
-void I_UnRegisterSong(INT32 handle)
+void I_UnloadSong(void)
 {
 	handle = 0;
 	if (nomidimusic)
@@ -496,20 +503,6 @@ boolean I_LoadSong(char *data, size_t len)
 	return 1;
 }
 
-/// \todo Add OGG/MP3 support for dos
-boolean I_StartDigSong(const char *musicname, INT32 looping)
-{
-	musicname = NULL;
-	looping = 0;
-	//CONS_Printf("I_StartDigSong: Not yet supported under DOS.\n");
-	return false;
-}
-
-void I_StopDigSong(void)
-{
-//	CONS_Printf("I_StopDigSong: Not yet supported under DOS.\n");
-}
-
 void I_SetDigMusicVolume(INT32 volume)
 {
 	volume = 0;
@@ -524,4 +517,4 @@ boolean I_SetSongSpeed(float speed)
 {
 	(void)speed;
 	return false;
-}
+}
\ No newline at end of file
diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c
index 2f6f0001c0ef6bcf70f9f85ffa39bfa13eac0446..60cf51f732ce4a296d2573f52c9b20190f63b955 100644
--- a/src/dummy/i_sound.c
+++ b/src/dummy/i_sound.c
@@ -61,11 +61,21 @@ void I_SetSfxVolume(UINT8 volume)
 //  MUSIC I/O
 //
 
+musictype_t I_GetMusicType(void)
+{
+	return MU_NONE;
+}
+
 void I_InitMusic(void){}
 
 void I_ShutdownMusic(void){}
 
-void I_PauseSong(INT32 handle)
+void I_SetMIDIMusicVolume(UINT8 volume)
+{
+	(void)volume;
+}
+
+void I_PauseSong(void)
 {
 	(void)handle;
 }
@@ -93,12 +103,12 @@ boolean I_PlaySong(boolean looping)
 	return false;
 }
 
-void I_StopSong(INT32 handle)
+void I_StopSong(void)
 {
 	(void)handle;
 }
 
-void I_UnRegisterSong(INT32 handle)
+void I_UnloadSong(void)
 {
 	(void)handle;
 }
@@ -107,19 +117,6 @@ void I_UnRegisterSong(INT32 handle)
 //  DIGMUSIC I/O
 //
 
-void I_InitDigMusic(void){}
-
-void I_ShutdownDigMusic(void){}
-
-boolean I_StartDigSong(const char *musicname, boolean looping)
-{
-	(void)musicname;
-	(void)looping;
-	return false;
-}
-
-void I_StopDigSong(void){}
-
 void I_SetDigMusicVolume(UINT8 volume)
 {
 	(void)volume;
@@ -135,4 +132,4 @@ boolean I_SetSongTrack(int track)
 {
 	(void)track;
 	return false;
-}
+}
\ No newline at end of file
diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c
index c714f675b7afe83d9f82d9370c349ebf9d9c98b1..b729d4d89edbbc59a4044f748626c42f4238307e 100644
--- a/src/sdl/sdl_sound.c
+++ b/src/sdl/sdl_sound.c
@@ -1313,10 +1313,27 @@ void I_StartupSound(void)
 // MUSIC API.
 //
 
-void I_ShutdownMIDIMusic(void)
+musictype_t I_GetMusicType(void)
 {
-	nomidimusic = false;
-	if (nodigimusic) I_ShutdownMusic();
+#ifdef HAVE_MIXER
+#ifdef HAVE_LIBGME
+	if (gme)
+		return MU_GME;
+	else
+#endif
+	if (!music)
+		return MU_NONE;
+	else if (Mix_GetMusicType(music) == MUS_MID)
+		return MU_MID;
+	else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG_UNUSED)
+		return MU_MOD;
+	else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD_UNUSED)
+		return MU_MP3;
+	else
+		return (musictype_t)Mix_GetMusicType(music);
+#else
+	return MU_NONE
+#endif
 }
 
 #ifdef HAVE_LIBGME
@@ -1330,12 +1347,6 @@ static void I_ShutdownGMEMusic(void)
 }
 #endif
 
-void I_ShutdownDigMusic(void)
-{
-	nodigimusic = false;
-	if (nomidimusic) I_ShutdownMusic();
-}
-
 #ifdef HAVE_MIXER
 static boolean LoadSong(void *data, size_t lumplength, size_t selectpos)
 {
@@ -1436,8 +1447,8 @@ void I_ShutdownMusic(void)
 
 	CONS_Printf("%s", M_GetText("I_ShutdownMusic: "));
 
-	I_UnRegisterSong(0);
-	I_StopDigSong();
+	I_UnloadSong();
+	I_StopSong();
 	Mix_CloseAudio();
 #ifdef MIX_INIT
 	Mix_Quit();
@@ -1450,16 +1461,6 @@ void I_ShutdownMusic(void)
 #endif
 }
 
-void I_InitMIDIMusic(void)
-{
-	if (nodigimusic) I_InitMusic();
-}
-
-void I_InitDigMusic(void)
-{
-	if (nomidimusic) I_InitMusic();
-}
-
 void I_InitMusic(void)
 {
 #ifdef HAVE_MIXER
@@ -1639,17 +1640,29 @@ void I_ResumeSong(void)
 #endif
 }
 
-void I_StopSong(INT32 handle)
+void I_StopSong(void)
 {
-	(void)handle;
+	I_StopGME();
 #ifdef HAVE_MIXER
-	if (nomidimusic || !musicStarted)
+	if (nodigimusic)
 		return;
-	Mix_FadeOutMusic(MIDIfade);
+
+#ifdef MIXER_POS
+	if (canlooping)
+		Mix_HookMusicFinished(NULL);
 #endif
+
+	Mix_HaltMusic();
+	while (Mix_PlayingMusic())
+		;
+
+	if (music[1])
+		Mix_FreeMusic(music[1]);
+	music[1] = NULL;
+	LoadSong(NULL, 0, 1);
 }
 
-void I_UnRegisterSong(INT32 handle)
+void I_UnloadSong(void)
 {
 #ifdef HAVE_MIXER
 
@@ -1714,7 +1727,7 @@ static void I_CleanupGME(void *userdata)
 static boolean I_StartGMESong(const char *musicname, boolean looping)
 {
 #ifdef HAVE_LIBGME
-	XBOXSTATIC char filename[9];
+	char filename[9];
 	void *data;
 	lumpnum_t lumpnum;
 	size_t lumplength;
@@ -1769,7 +1782,7 @@ static boolean I_StartGMESong(const char *musicname, boolean looping)
 boolean I_StartDigSong(const char *musicname, boolean looping)
 {
 #ifdef HAVE_MIXER
-	XBOXSTATIC char filename[9];
+	char filename[9];
 	void *data;
 	lumpnum_t lumpnum;
 	size_t lumplength;
@@ -1786,7 +1799,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 
 	lumpnum = W_CheckNumForName(filename);
 
-	I_StopDigSong();
+	I_StopSong();
 
 	if (lumpnum == LUMPERROR)
 	{
@@ -1811,7 +1824,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 	{
 		size_t scan;
 		const char *dataum = data;
-		XBOXSTATIC char looplength[64];
+		char looplength[64];
 		UINT32 loopstart = 0;
 		UINT8 newcount = 0;
 
@@ -1938,29 +1951,6 @@ static void I_StopGME(void)
 #endif
 }
 
-void I_StopDigSong(void)
-{
-	I_StopGME();
-#ifdef HAVE_MIXER
-	if (nodigimusic)
-		return;
-
-#ifdef MIXER_POS
-	if (canlooping)
-		Mix_HookMusicFinished(NULL);
-#endif
-
-	Mix_HaltMusic();
-	while (Mix_PlayingMusic())
-		;
-
-	if (music[1])
-		Mix_FreeMusic(music[1]);
-	music[1] = NULL;
-	LoadSong(NULL, 0, 1);
-#endif
-}
-
 void I_SetDigMusicVolume(UINT8 volume)
 {
 	I_SetMIDIMusicVolume(volume);
@@ -1995,4 +1985,4 @@ static void SDLCALL I_FinishMusic(void)
 	if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
 }
 #endif
-#endif //HAVE_SDL
+#endif //HAVE_SDL
\ No newline at end of file
diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c
index 18c88d267ae28fea5f3a9d66f9c6d7a905528735..295d6868036f07593768f79d3819bf6050d70551 100644
--- a/src/win32/win_snd.c
+++ b/src/win32/win_snd.c
@@ -22,12 +22,10 @@
 #define HAVE_ZLIB
 
 #ifndef _MSC_VER
-#ifndef _WII
 #ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #endif
-#endif
 
 #ifndef _LFS64_LARGEFILE
 #define _LFS64_LARGEFILE
@@ -44,7 +42,6 @@
 static FMOD_SYSTEM *fsys;
 static FMOD_SOUND *music_stream;
 static FMOD_CHANNEL *music_channel;
-static boolean midimode;
 
 static UINT8 music_volume, midi_volume, sfx_volume;
 static INT32 current_track;
@@ -446,14 +443,48 @@ void I_SetSfxVolume(UINT8 volume)
 // MUSIC
 //
 
+musictype_t I_GetMusicType(void)
+{
+#ifdef HAVE_LIBGME
+	if (gme)
+		return MU_GME;
+#endif
+
+	if (!music_stream)
+		return MU_NONE;
+
+	FMOD_SOUND_TYPE type;
+	if (FMOD_Sound_GetFormat(music_stream, &type, NULL, NULL, NULL) == FMOD_OK)
+	{
+		switch(type)
+		{
+			case FMOD_SOUND_TYPE_WAV:
+				return MU_WAV;
+			case FMOD_SOUND_TYPE_MOD:
+				return MU_MOD;
+			case FMOD_SOUND_TYPE_MID:
+				return MU_MID;
+			case FMOD_SOUND_TYPE_OGGVORBIS:
+				return MU_OGG;
+			case FMOD_SOUND_TYPE_MP3:
+				return MU_MP3;
+			case FMOD_SOUND_TYPE_FLAC:
+				return MU_FLAC;
+			default:
+				return MU_NONE;
+		}
+	}
+	else
+		return MU_NONE;
+}
+
 void I_InitMusic(void)
 {
 }
 
 void I_ShutdownMusic(void)
 {
-	I_ShutdownDigMusic();
-	I_ShutdownMIDIMusic();
+	I_StopSong();
 }
 
 void I_PauseSong(void)
@@ -470,17 +501,7 @@ void I_ResumeSong(void)
 		FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false));
 }
 
-void I_InitDigMusic(void)
-{
-}
-
-void I_ShutdownDigMusic(void)
-{
-	if (!midimode)
-		I_StopDigSong();
-}
-
-boolean I_StartDigSong(const char *musicname, boolean looping)
+boolean I_LoadSong(char *data, size_t len)
 {
 	char *data;
 	size_t len;
@@ -492,10 +513,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 		lumpnum = W_CheckNumForName(va("D_%s",musicname));
 		if (lumpnum == LUMPERROR)
 			return false;
-		midimode = true;
 	}
-	else
-		midimode = false;
 
 	data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC);
 	len = W_LumpLength(lumpnum);
@@ -605,8 +623,6 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 	{
 		gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
 		Z_Free(data); // We don't need this anymore.
-		gme_start_track(gme, 0);
-		current_track = 0;
 		gme_set_equalizer(gme,&gmeq);
 		fmt.format = FMOD_SOUND_FORMAT_PCM16;
 		fmt.defaultfrequency = 44100;
@@ -616,32 +632,21 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 		fmt.pcmreadcallback = GMEReadCallback;
 		fmt.userdata = gme;
 		FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER | (looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream));
-		FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
-		FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
-		FMR(FMOD_Channel_SetPriority(music_channel, 0));
 		return true;
 	}
 #endif
 
 	fmt.length = len;
+
+	FMOD_RESULT e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT|(looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream);
+	if (e != FMOD_OK)
 	{
-		FMOD_RESULT e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT|(looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream);
-		if (e != FMOD_OK)
-		{
-			if (e == FMOD_ERR_FORMAT)
-				CONS_Alert(CONS_WARNING, "Failed to play music lump %s due to invalid format.\n", W_CheckNameForNum(lumpnum));
-			else
-				FMR(e);
-			return false;
-		}
+		if (e == FMOD_ERR_FORMAT)
+			CONS_Alert(CONS_WARNING, "Failed to play music lump %s due to invalid format.\n", W_CheckNameForNum(lumpnum));
+		else
+			FMR(e);
+		return false;
 	}
-	FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
-	if (midimode)
-		FMR(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0));
-	else
-		FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
-	FMR(FMOD_Channel_SetPriority(music_channel, 0));
-	current_track = 0;
 
 	// Try to find a loop point in streaming music formats (ogg, mp3)
 	FMOD_RESULT e;
@@ -704,28 +709,15 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 		return true;
 	}
 
-	// No special loop point, but we're playing so it's all good.
+	// No special loop point
 	return true;
 }
 
-void I_StopDigSong(void)
-{
-	if (music_stream)
-		FMR(FMOD_Sound_Release(music_stream));
-	music_stream = NULL;
-#ifdef HAVE_LIBGME
-	if (gme)
-		gme_delete(gme);
-	gme = NULL;
-#endif
-	current_track = -1;
-}
-
 void I_SetDigMusicVolume(UINT8 volume)
 {
 	// volume is 0 to 31.
 	music_volume = volume;
-	if (!midimode && music_stream)
+	if (I_GetMusicType() != MU_MID && music_stream)
 		FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0));
 }
 
@@ -811,57 +803,55 @@ boolean I_SetSongTrack(INT32 track)
 // Fuck MIDI. ... Okay fine, you can have your silly D_-only mode.
 //
 
-void I_InitMIDIMusic(void)
-{
-}
-
-void I_ShutdownMIDIMusic(void)
-{
-	if (midimode)
-		I_StopSong(0);
-}
-
 void I_SetMIDIMusicVolume(UINT8 volume)
 {
 	// volume is 0 to 31.
 	midi_volume = volume;
-	if (midimode && music_stream)
+	if (I_GetMusicType() != MU_MID && music_stream)
 		FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0));
 }
 
 boolean I_PlaySong(boolean looping)
 {
-	FMOD_CREATESOUNDEXINFO fmt;
-	memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO));
-	fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
-	fmt.length = len;
-	FMR(FMOD_System_CreateStream(fsys, (char *)data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream));
-	return 1337;
-}
-
-boolean I_PlaySong(INT32 handle, boolean looping)
-{
-	if (1337 == handle)
+#ifdef HAVE_LIBGME
+	if (gme)
 	{
-		midimode = true;
-		if (looping)
-			FMR(FMOD_Sound_SetMode(music_stream, FMOD_LOOP_NORMAL));
+		gme_start_track(gme, 0);
+		current_track = 0;
 		FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
-		FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0));
-		FMR_MUSIC(FMOD_Channel_SetPriority(music_channel, 0));
+		FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
+		FMR(FMOD_Channel_SetPriority(music_channel, 0));
+		return true;
 	}
+#endif
+
+	FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel));
+	if (I_GetMusicType() != MU_MID)
+		FMR(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0));
+	else
+		FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0));
+	FMR(FMOD_Channel_SetPriority(music_channel, 0));
+	current_track = 0;
+
 	return true;
 }
 
-void I_StopSong(INT32 handle)
+void I_StopSong(void)
 {
-	I_UnRegisterSong(handle);
+#ifdef HAVE_LIBGME
+	if (gme)
+		gme_delete(gme);
+	gme = NULL;
+#endif
+	current_track = -1;
+
+	I_UnloadSong();
 }
 
-void I_UnRegisterSong(INT32 handle)
+void I_UnloadSong(void)
 {
 	UNREFERENCED_PARAMETER(handle);
 	if (music_stream)
 		FMR(FMOD_Sound_Release(music_stream));
 	music_stream = NULL;
-}
+}
\ No newline at end of file