From 4538236a38aed286bb6ea7da4b2a0e8bfc8d3d3e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 17 Jun 2023 09:49:15 +0200 Subject: [PATCH] - cleaned i_music.h off external dependencies. * take I_BuildMIDIMenuList out of it * pass the command line state to disable music from the init call. * don't declare internal 'nomusic' variable in the header. --- src/common/audio/music/i_music.cpp | 5 ++--- src/common/audio/music/i_music.h | 13 +------------ src/common/audio/music/music.cpp | 4 ++++ src/common/menu/menudef.cpp | 1 + src/sound/s_doomsound.cpp | 3 ++- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/common/audio/music/i_music.cpp b/src/common/audio/music/i_music.cpp index 0bc8582923..6b85807246 100644 --- a/src/common/audio/music/i_music.cpp +++ b/src/common/audio/music/i_music.cpp @@ -40,7 +40,6 @@ #include #include -#include "m_argv.h" #include "filesystem.h" #include "c_dispatch.h" @@ -218,13 +217,13 @@ static void SetupDMXGUS() // //========================================================================== -void I_InitMusic(void) +void I_InitMusic(int musicstate) { I_InitSoundFonts(); snd_musicvolume->Callback (); - nomusic = !!Args->CheckParm("-nomusic") || !!Args->CheckParm("-nosound"); + nomusic = musicstate; snd_mididevice->Callback(); diff --git a/src/common/audio/music/i_music.h b/src/common/audio/music/i_music.h index a6609eadbe..aa2d48e628 100644 --- a/src/common/audio/music/i_music.h +++ b/src/common/audio/music/i_music.h @@ -34,27 +34,16 @@ #ifndef __I_MUSIC_H__ #define __I_MUSIC_H__ -#include "c_cvars.h" - -class FileReader; -struct FOptionValues; - // // MUSIC I/O // -void I_InitMusic (); -void I_BuildMIDIMenuList (FOptionValues *); +void I_InitMusic (int); // Volume. void I_SetRelativeVolume(float); void I_SetMusicVolume (double volume); -extern int nomusic; - -EXTERN_CVAR(Bool, mus_enabled) -EXTERN_CVAR(Float, snd_musicvolume) - inline float AmplitudeTodB(float amplitude) { diff --git a/src/common/audio/music/music.cpp b/src/common/audio/music/music.cpp index 610f0368f7..6101dc1cce 100644 --- a/src/common/audio/music/music.cpp +++ b/src/common/audio/music/music.cpp @@ -53,9 +53,11 @@ #include "gain_analysis.h" #include "i_specialpaths.h" #include "configfile.h" +#include "c_cvars.h" // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- +extern int nomusic; extern float S_GetMusicVolume (const char *music); static void S_ActivatePlayList(bool goBack); @@ -81,6 +83,8 @@ static MusicCallbacks mus_cb = { nullptr, DefaultOpenMusic }; // PUBLIC DATA DEFINITIONS ------------------------------------------------- +EXTERN_CVAR(Bool, mus_enabled) +EXTERN_CVAR(Float, snd_musicvolume) EXTERN_CVAR(Int, snd_mididevice) EXTERN_CVAR(Float, mod_dumb_mastervolume) EXTERN_CVAR(Float, fluid_gain) diff --git a/src/common/menu/menudef.cpp b/src/common/menu/menudef.cpp index 4fbeeb0bb6..e81bda2d2d 100644 --- a/src/common/menu/menudef.cpp +++ b/src/common/menu/menudef.cpp @@ -1662,6 +1662,7 @@ static void InitMusicMenus() // Special menus will be created once all engine data is loaded // //============================================================================= +void I_BuildMIDIMenuList(FOptionValues*); void M_CreateMenus() { diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index bc5c092b01..50509eb3d6 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -66,6 +66,7 @@ #include "g_game.h" #include "s_music.h" #include "v_draw.h" +#include "m_argv.h" // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -229,7 +230,7 @@ void S_Init() } I_InitSound(); - I_InitMusic(); + I_InitMusic(Args->CheckParm("-nomusic") || Args->CheckParm("-nosound")); // Heretic and Hexen have sound curve lookup tables. Doom does not. int curvelump = fileSystem.CheckNumForName("SNDCURVE");