Move SndDisableSdlMixer to CGameArg

This commit is contained in:
Kp 2015-11-24 04:05:36 +00:00
parent 2e91f1ac45
commit a579f75d05
7 changed files with 16 additions and 16 deletions

View file

@ -73,6 +73,11 @@ struct CArg : prohibit_void_ptr<CArg>
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<Arg>
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;

View file

@ -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<MVESTREAM>)
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();
}

View file

@ -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();

View file

@ -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 );

View file

@ -958,7 +958,7 @@ int read_hamfile()
{
shareware = 1;
GameArg.SndDigiSampleRate = SAMPLE_RATE_11K;
if (GameArg.SndDisableSdlMixer)
if (CGameArg.SndDisableSdlMixer)
{
digi_close();
digi_init();

View file

@ -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)

View file

@ -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
}