Add S_RestartMusic function and call it directly when changing amiga filter types

This commit is contained in:
indev committed 2023-08-20 16:48:58 +03:00
1 parent a1d08b219d
commit e8ab7e6271
2 files changed
+25 -16

No files matched your search

+22 -16
View File
@@ -2044,6 +2044,24 @@ void S_Start(void)
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
}
void S_RestartMusic(void)
{
S_StopMusic();
I_ShutdownMusic();
I_InitMusic();
#ifdef NO_MIDI
S_SetMusicVolume(cv_digmusicvolume.value, -1);
#else
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
#endif
if (Playing()) // Gotta make sure the player is in a level
P_RestoreMusic(&players[consoleplayer]);
else
S_ChangeMusicInternal("titles", looptitle);
}
static void Command_Tunes_f(void)
{
const char *tunearg;
@@ -2150,20 +2168,7 @@ static void Command_RestartAudio_f(void)
static void Command_RestartMusic_f(void) //same as RestartAudio but only music gets restarted
{
S_StopMusic();
I_ShutdownMusic();
I_InitMusic();
#ifdef NO_MIDI
S_SetMusicVolume(cv_digmusicvolume.value, -1);
#else
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
#endif
if (Playing()) // Gotta make sure the player is in a level
P_RestoreMusic(&players[consoleplayer]);
else
S_ChangeMusicInternal("titles", looptitle);
S_RestartMusic();
}
void GameSounds_OnChange(void)
@@ -2242,8 +2247,9 @@ void AmigaType_OnChange(void)
{
if (openmpt_mhandle)
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigatype.string);
COM_ImmedExecute("restartmusic"); //need to restart the music system or else it wont work
}
S_RestartMusic(); //need to restart the music system or else it wont work
}
#endif
#endif
+3
View File
@@ -108,6 +108,9 @@ void S_StopSounds(void);
void S_ClearSfx(void);
void S_Start(void);
// Stops music and restarts it from same position. Used for instant applying changes to amiga filters.
void S_RestartMusic(void);
//
// Basically a W_GetNumForName that adds "ds" at the beginning of the string. Returns a lumpnum.
//