nodigimusic nomusic nosound refactor other targets

(cherry picked from commit 86f151db65)
This commit is contained in:
mazmazz 2018-08-23 12:43:38 -04:00
parent a414ccf24a
commit 17cf310b84
3 changed files with 43 additions and 43 deletions

View File

@ -134,7 +134,7 @@ FUNCINLINE static ATTRINLINE int Volset(int vol)
void I_SetSfxVolume(INT32 volume) void I_SetSfxVolume(INT32 volume)
{ {
if (nosound) if (sound_disabled)
return; return;
set_volume (Volset(volume),-1); set_volume (Volset(volume),-1);
@ -142,7 +142,7 @@ void I_SetSfxVolume(INT32 volume)
void I_SetMusicVolume(INT32 volume) void I_SetMusicVolume(INT32 volume)
{ {
if (nomidimusic) if (midi_disabled)
return; return;
// Now set volume on output device. // Now set volume on output device.
@ -169,7 +169,7 @@ INT32 I_StartSound ( sfxenum_t id,
{ {
int voice; int voice;
if (nosound) if (sound_disabled)
return 0; return 0;
// UNUSED // UNUSED
@ -190,7 +190,7 @@ void I_StopSound (INT32 handle)
// an setting the channel to zero. // an setting the channel to zero.
int voice=handle & (VIRTUAL_VOICES-1); int voice=handle & (VIRTUAL_VOICES-1);
if (nosound) if (sound_disabled)
return; return;
if (voice_check(voice)==S_sfx[handle>>VOICESSHIFT].data) if (voice_check(voice)==S_sfx[handle>>VOICESSHIFT].data)
@ -199,7 +199,7 @@ void I_StopSound (INT32 handle)
INT32 I_SoundIsPlaying(INT32 handle) INT32 I_SoundIsPlaying(INT32 handle)
{ {
if (nosound) if (sound_disabled)
return FALSE; return FALSE;
if (voice_check(handle & (VIRTUAL_VOICES-1))==S_sfx[handle>>VOICESSHIFT].data) if (voice_check(handle & (VIRTUAL_VOICES-1))==S_sfx[handle>>VOICESSHIFT].data)
@ -229,7 +229,7 @@ void I_UpdateSoundParams( INT32 handle,
int voice=handle & (VIRTUAL_VOICES-1); int voice=handle & (VIRTUAL_VOICES-1);
int numsfx=handle>>VOICESSHIFT; int numsfx=handle>>VOICESSHIFT;
if (nosound) if (sound_disabled)
return; return;
if (voice_check(voice)==S_sfx[numsfx].data) if (voice_check(voice)==S_sfx[numsfx].data)
@ -270,17 +270,17 @@ void I_StartupSound(void)
char err[255]; char err[255];
#endif #endif
if (nosound) if (sound_disabled)
sfxcard=DIGI_NONE; sfxcard=DIGI_NONE;
else else
sfxcard=DIGI_AUTODETECT; sfxcard=DIGI_AUTODETECT;
if (nomidimusic) if (midi_disabled)
midicard=MIDI_NONE; midicard=MIDI_NONE;
else else
midicard=MIDI_AUTODETECT; //DetectMusicCard(); midicard=MIDI_AUTODETECT; //DetectMusicCard();
nodigimusic=true; //Alam: No OGG/MP3/IT/MOD support digital_disabled=true; //Alam: No OGG/MP3/IT/MOD support
// Secure and configure sound device first. // Secure and configure sound device first.
CONS_Printf("I_StartupSound: "); CONS_Printf("I_StartupSound: ");
@ -293,8 +293,8 @@ void I_StartupSound(void)
{ {
sprintf (err,"Sound init error : %s\n",allegro_error); sprintf (err,"Sound init error : %s\n",allegro_error);
CONS_Error (err); CONS_Error (err);
nosound=true; sound_disabled=true;
nomidimusic=true; midi_disabled=true;
} }
else else
{ {
@ -409,7 +409,7 @@ static MIDI *load_midi_mem(char *mempointer,int *e)
void I_InitMusic(void) void I_InitMusic(void)
{ {
if (nomidimusic) if (midi_disabled)
return; return;
I_AddExitFunc(I_ShutdownMusic); I_AddExitFunc(I_ShutdownMusic);
@ -430,7 +430,7 @@ void I_ShutdownMusic(void)
boolean I_PlaySong(boolean looping) boolean I_PlaySong(boolean looping)
{ {
handle = 0; handle = 0;
if (nomidimusic) if (midi_disabled)
return false; return false;
islooping = looping; islooping = looping;
@ -443,7 +443,7 @@ boolean I_PlaySong(boolean looping)
void I_PauseSong (INT32 handle) void I_PauseSong (INT32 handle)
{ {
handle = 0; handle = 0;
if (nomidimusic) if (midi_disabled)
return; return;
midi_pause(); midi_pause();
songpaused = true; songpaused = true;
@ -452,7 +452,7 @@ void I_PauseSong (INT32 handle)
void I_ResumeSong (INT32 handle) void I_ResumeSong (INT32 handle)
{ {
handle = 0; handle = 0;
if (nomidimusic) if (midi_disabled)
return; return;
midi_resume(); midi_resume();
songpaused = false; songpaused = false;
@ -461,7 +461,7 @@ void I_ResumeSong (INT32 handle)
void I_StopSong(void) void I_StopSong(void)
{ {
handle = 0; handle = 0;
if (nomidimusic) if (midi_disabled)
return; return;
islooping = 0; islooping = 0;
@ -474,7 +474,7 @@ void I_StopSong(void)
#if 0 #if 0
int I_QrySongPlaying(int handle) int I_QrySongPlaying(int handle)
{ {
if (nomidimusic) if (midi_disabled)
return 0; return 0;
//return islooping || musicdies > gametic; //return islooping || musicdies > gametic;
@ -485,7 +485,7 @@ int I_QrySongPlaying(int handle)
void I_UnloadSong(void) void I_UnloadSong(void)
{ {
handle = 0; handle = 0;
if (nomidimusic) if (midi_disabled)
return; return;
//destroy_midi(currsong); //destroy_midi(currsong);
@ -494,7 +494,7 @@ void I_UnloadSong(void)
boolean I_LoadSong(char *data, size_t len) boolean I_LoadSong(char *data, size_t len)
{ {
int e = len; //Alam: For error int e = len; //Alam: For error
if (nomidimusic) if (midi_disabled)
return 0; return 0;
if (memcmp(data,"MThd",4)==0) // support mid file in WAD !!! if (memcmp(data,"MThd",4)==0) // support mid file in WAD !!!

View File

@ -361,7 +361,7 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan
if (splitscreen) listenmobj2 = players[secondarydisplayplayer].mo; if (splitscreen) listenmobj2 = players[secondarydisplayplayer].mo;
if (nosound) if (sound_disabled)
return -1; return -1;
sfx = &S_sfx[sfx_id]; sfx = &S_sfx[sfx_id];

View File

@ -194,8 +194,8 @@ static srb2audio_t localdata;
static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio callback static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio callback
{ {
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
else if (nosound) return; else if (sound_disabled) return;
else if (nomidimusic && nodigimusic else if (midi_disabled && digital_disabled
#ifdef HW3SOUND #ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE && hws_mode == HWS_DEFAULT_MODE
#endif #endif
@ -208,8 +208,8 @@ static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio call
static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio callback static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio callback
{ {
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
else if (nosound) return; else if (sound_disabled) return;
else if (nomidimusic && nodigimusic else if (midi_disabled && digital_disabled
#ifdef HW3SOUND #ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE && hws_mode == HWS_DEFAULT_MODE
#endif #endif
@ -493,7 +493,7 @@ static inline void I_SetChannels(void)
INT32 *steptablemid = steptable + 128; INT32 *steptablemid = steptable + 128;
if (nosound) if (sound_disabled)
return; return;
// This table provides step widths for pitch parameters. // This table provides step widths for pitch parameters.
@ -609,7 +609,7 @@ INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priori
(void)priority; (void)priority;
(void)pitch; (void)pitch;
if (nosound) if (sound_disabled)
return 0; return 0;
if (S_sfx[id].data == NULL) return -1; if (S_sfx[id].data == NULL) return -1;
@ -1136,7 +1136,7 @@ static INT32 Init3DSDriver(const char *soName)
void I_ShutdownSound(void) void I_ShutdownSound(void)
{ {
if (nosound || !sound_started) if (sound_disabled || !sound_started)
return; return;
CONS_Printf("I_ShutdownSound: "); CONS_Printf("I_ShutdownSound: ");
@ -1150,7 +1150,7 @@ void I_ShutdownSound(void)
} }
#endif #endif
if (nomidimusic && nodigimusic) if (midi_disabled && digital_disabled)
SDL_CloseAudio(); SDL_CloseAudio();
CONS_Printf("%s", M_GetText("shut down\n")); CONS_Printf("%s", M_GetText("shut down\n"));
sound_started = false; sound_started = false;
@ -1170,7 +1170,7 @@ void I_StartupSound(void)
const char *sdrv_name = NULL; const char *sdrv_name = NULL;
#endif #endif
#ifndef HAVE_MIXER #ifndef HAVE_MIXER
nomidimusic = nodigimusic = true; midi_disabled = digital_disabled = true;
#endif #endif
memset(channels, 0, sizeof (channels)); //Alam: Clean it memset(channels, 0, sizeof (channels)); //Alam: Clean it
@ -1213,7 +1213,7 @@ void I_StartupSound(void)
audio.samples /= 2; audio.samples /= 2;
} }
if (nosound) if (sound_disabled)
return; return;
#ifdef HW3SOUND #ifdef HW3SOUND
@ -1261,7 +1261,7 @@ void I_StartupSound(void)
{ {
snddev_t snddev; snddev_t snddev;
//nosound = true; //sound_disabled = true;
//I_AddExitFunc(I_ShutdownSound); //I_AddExitFunc(I_ShutdownSound);
snddev.bps = 16; snddev.bps = 16;
snddev.sample_rate = audio.freq; snddev.sample_rate = audio.freq;
@ -1288,7 +1288,7 @@ void I_StartupSound(void)
if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0) if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0)
{ {
CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n")); CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
nosound = true; sound_disabled = true;
return; return;
} }
else else
@ -1452,7 +1452,7 @@ static boolean LoadSong(void *data, size_t lumplength, size_t selectpos)
void I_ShutdownMusic(void) void I_ShutdownMusic(void)
{ {
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted) if ((midi_disabled && digital_disabled) || !musicStarted)
return; return;
CONS_Printf("%s", M_GetText("I_ShutdownMusic: ")); CONS_Printf("%s", M_GetText("I_ShutdownMusic: "));
@ -1543,7 +1543,7 @@ void I_InitMusic(void)
if (Mix_OpenAudio(audio.freq, audio.format, audio.channels, audio.samples) < 0) //open_music(&audio) if (Mix_OpenAudio(audio.freq, audio.format, audio.channels, audio.samples) < 0) //open_music(&audio)
{ {
CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError()); CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError());
nomidimusic = nodigimusic = true; midi_disabled = digital_disabled = true;
if (sound_started if (sound_started
#ifdef HW3SOUND #ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE && hws_mode == HWS_DEFAULT_MODE
@ -1553,7 +1553,7 @@ void I_InitMusic(void)
if (SDL_OpenAudio(&audio, NULL) < 0) //retry if (SDL_OpenAudio(&audio, NULL) < 0) //retry
{ {
CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n")); CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
nosound = true; sound_disabled = true;
sound_started = false; sound_started = false;
} }
else else
@ -1588,7 +1588,7 @@ boolean I_PlaySong(INT32 handle, boolean looping)
{ {
(void)handle; (void)handle;
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if (nomidimusic || !musicStarted || !music[handle]) if (midi_disabled || !musicStarted || !music[handle])
return false; return false;
#ifdef MIXER_POS #ifdef MIXER_POS
@ -1621,7 +1621,7 @@ void I_PauseSong(void)
(void)handle; (void)handle;
I_PauseGME(); I_PauseGME();
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted) if ((midi_disabled && digital_disabled) || !musicStarted)
return; return;
Mix_PauseMusic(); Mix_PauseMusic();
@ -1641,7 +1641,7 @@ void I_ResumeSong(void)
(void)handle; (void)handle;
I_ResumeGME(); I_ResumeGME();
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted) if ((midi_disabled && digital_disabled) || !musicStarted)
return; return;
Mix_VolumeMusic(musicvol); Mix_VolumeMusic(musicvol);
@ -1654,7 +1654,7 @@ void I_StopSong(void)
{ {
I_StopGME(); I_StopGME();
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if (nodigimusic) if (digital_disabled)
return; return;
#ifdef MIXER_POS #ifdef MIXER_POS
@ -1676,7 +1676,7 @@ void I_UnloadSong(void)
{ {
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if (nomidimusic || !musicStarted) if (midi_disabled || !musicStarted)
return; return;
Mix_HaltMusic(); Mix_HaltMusic();
@ -1695,7 +1695,7 @@ void I_UnloadSong(void)
boolean I_LoadSong(char *data, size_t len) boolean I_LoadSong(char *data, size_t len)
{ {
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if (nomidimusic || !musicStarted) if (midi_disabled || !musicStarted)
return false; return false;
if (!LoadSong(data, len, 0)) if (!LoadSong(data, len, 0))
@ -1715,7 +1715,7 @@ boolean I_LoadSong(char *data, size_t len)
void I_SetMusicVolume(UINT8 volume) void I_SetMusicVolume(UINT8 volume)
{ {
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted) if ((midi_disabled && digital_disabled) || !musicStarted)
return; return;
if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
@ -1802,7 +1802,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
return true; return true;
#ifdef HAVE_MIXER #ifdef HAVE_MIXER
if (nodigimusic) if (digital_disabled)
return false; return false;
snprintf(filename, sizeof filename, "o_%s", musicname); snprintf(filename, sizeof filename, "o_%s", musicname);