diff --git a/common/include/args.h b/common/include/args.h index 06989ea56..05f417e8b 100644 --- a/common/include/args.h +++ b/common/include/args.h @@ -73,6 +73,11 @@ struct CArg : prohibit_void_ptr bool SysNoHogDir; #endif bool SysShowCmdHelp; +#ifdef USE_SDLMIXER + bool SndDisableSdlMixer; +#else + static constexpr tt::true_type SndDisableSdlMixer{}; +#endif int DbgVerbose; int SysMaxFPS; std::string SysMissionDir; @@ -95,11 +100,6 @@ struct Arg : prohibit_void_ptr bool CtlNoJoystick; bool SndNoSound; bool SndNoMusic; -#ifdef USE_SDLMIXER - bool SndDisableSdlMixer; -#else - static constexpr tt::true_type SndDisableSdlMixer{}; -#endif bool GfxSkipHiresFNT; #ifdef DXX_BUILD_DESCENT_I bool EdiNoBm; diff --git a/d2x-rebirth/libmve/mveplay.cpp b/d2x-rebirth/libmve/mveplay.cpp index 65554d4ab..824af1de2 100644 --- a/d2x-rebirth/libmve/mveplay.cpp +++ b/d2x-rebirth/libmve/mveplay.cpp @@ -351,7 +351,7 @@ static int create_audiobuf_handler(unsigned char, unsigned char minor, const uns format = AUDIO_U8; } - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) { con_printf(CON_CRITICAL, "creating audio buffers:"); con_printf(CON_CRITICAL, "sample rate = %d, desired buffer = %d, stereo = %d, bitsize = %d, compressed = %d", @@ -367,7 +367,7 @@ static int create_audiobuf_handler(unsigned char, unsigned char minor, const uns mve_audio_spec->userdata = NULL; // MD2211: if using SDL_Mixer, we never reinit the sound system - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) { if (SDL_OpenAudio(mve_audio_spec.get(), NULL) >= 0) { con_printf(CON_CRITICAL, " success"); @@ -397,7 +397,7 @@ static int play_audio_handler(unsigned char, unsigned char, const unsigned char { if (mve_audio_canplay && !mve_audio_playing && mve_audio_bufhead != mve_audio_buftail) { - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) SDL_PauseAudio(0); #ifdef USE_SDLMIXER else @@ -458,7 +458,7 @@ static int audio_data_handler(unsigned char major, unsigned char, const unsigned // MD2211: the following block does on-the-fly audio conversion for SDL_mixer #ifdef USE_SDLMIXER - if (!GameArg.SndDisableSdlMixer) { + if (!CGameArg.SndDisableSdlMixer) { // build converter: in = MVE format, out = SDL_mixer output Mix_QuerySpec(&out_freq, &out_format, &out_channels); // get current output settings @@ -749,7 +749,7 @@ void MVE_rmEndMovie(std::unique_ptr) if (mve_audio_canplay) { // MD2211: if using SDL_Mixer, we never reinit sound, hence never close it - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) { SDL_CloseAudio(); } diff --git a/d2x-rebirth/main/movie.cpp b/d2x-rebirth/main/movie.cpp index 4760c16fc..d6d0869cd 100644 --- a/d2x-rebirth/main/movie.cpp +++ b/d2x-rebirth/main/movie.cpp @@ -168,7 +168,7 @@ int PlayMovie(const char *subtitles, const char *filename, int must_have) songs_stop_all(); // MD2211: if using SDL_Mixer, we never reinit the sound system - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) digi_close(); // Start sound @@ -178,7 +178,7 @@ int PlayMovie(const char *subtitles, const char *filename, int must_have) // MD2211: if using SDL_Mixer, we never reinit the sound system if (!GameArg.SndNoSound - && GameArg.SndDisableSdlMixer + && CGameArg.SndDisableSdlMixer ) digi_init(); diff --git a/similar/arch/sdl/init.cpp b/similar/arch/sdl/init.cpp index fcdc532f6..5faac5c02 100644 --- a/similar/arch/sdl/init.cpp +++ b/similar/arch/sdl/init.cpp @@ -49,7 +49,7 @@ void arch_init(void) key_init(); int system = SDLAUDIO_SYSTEM; - if (!GameArg.SndDisableSdlMixer) + if (!CGameArg.SndDisableSdlMixer) system = SDLMIXER_SYSTEM; digi_select_system( system ); diff --git a/similar/main/piggy.cpp b/similar/main/piggy.cpp index f324dbf01..86919f1d9 100644 --- a/similar/main/piggy.cpp +++ b/similar/main/piggy.cpp @@ -958,7 +958,7 @@ int read_hamfile() { shareware = 1; GameArg.SndDigiSampleRate = SAMPLE_RATE_11K; - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) { digi_close(); digi_init(); diff --git a/similar/main/songs.cpp b/similar/main/songs.cpp index b3010118e..9a3ccc74a 100644 --- a/similar/main/songs.cpp +++ b/similar/main/songs.cpp @@ -158,7 +158,7 @@ static void songs_init() GameCfg.MusicType = MUSIC_TYPE_NONE; // If SDL_Mixer is not supported (or deactivated), switch to no-music type if SDL_mixer-related music type was selected - if (GameArg.SndDisableSdlMixer) + if (CGameArg.SndDisableSdlMixer) { #ifndef _WIN32 if (GameCfg.MusicType == MUSIC_TYPE_BUILTIN) diff --git a/similar/misc/args.cpp b/similar/misc/args.cpp index 2c704791e..7bb989322 100644 --- a/similar/misc/args.cpp +++ b/similar/misc/args.cpp @@ -260,7 +260,7 @@ static void ReadCmdArgs(Inilist &ini, Arglist &Args) else if (!d_stricmp(p, "-nosdlmixer")) { #ifdef USE_SDLMIXER - GameArg.SndDisableSdlMixer = true; + CGameArg.SndDisableSdlMixer = true; #endif }