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)
{
if (nosound)
if (sound_disabled)
return;
set_volume (Volset(volume),-1);
@ -142,7 +142,7 @@ void I_SetSfxVolume(INT32 volume)
void I_SetMusicVolume(INT32 volume)
{
if (nomidimusic)
if (midi_disabled)
return;
// Now set volume on output device.
@ -169,7 +169,7 @@ INT32 I_StartSound ( sfxenum_t id,
{
int voice;
if (nosound)
if (sound_disabled)
return 0;
// UNUSED
@ -190,7 +190,7 @@ void I_StopSound (INT32 handle)
// an setting the channel to zero.
int voice=handle & (VIRTUAL_VOICES-1);
if (nosound)
if (sound_disabled)
return;
if (voice_check(voice)==S_sfx[handle>>VOICESSHIFT].data)
@ -199,7 +199,7 @@ void I_StopSound (INT32 handle)
INT32 I_SoundIsPlaying(INT32 handle)
{
if (nosound)
if (sound_disabled)
return FALSE;
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 numsfx=handle>>VOICESSHIFT;
if (nosound)
if (sound_disabled)
return;
if (voice_check(voice)==S_sfx[numsfx].data)
@ -270,17 +270,17 @@ void I_StartupSound(void)
char err[255];
#endif
if (nosound)
if (sound_disabled)
sfxcard=DIGI_NONE;
else
sfxcard=DIGI_AUTODETECT;
if (nomidimusic)
if (midi_disabled)
midicard=MIDI_NONE;
else
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.
CONS_Printf("I_StartupSound: ");
@ -293,8 +293,8 @@ void I_StartupSound(void)
{
sprintf (err,"Sound init error : %s\n",allegro_error);
CONS_Error (err);
nosound=true;
nomidimusic=true;
sound_disabled=true;
midi_disabled=true;
}
else
{
@ -409,7 +409,7 @@ static MIDI *load_midi_mem(char *mempointer,int *e)
void I_InitMusic(void)
{
if (nomidimusic)
if (midi_disabled)
return;
I_AddExitFunc(I_ShutdownMusic);
@ -430,7 +430,7 @@ void I_ShutdownMusic(void)
boolean I_PlaySong(boolean looping)
{
handle = 0;
if (nomidimusic)
if (midi_disabled)
return false;
islooping = looping;
@ -443,7 +443,7 @@ boolean I_PlaySong(boolean looping)
void I_PauseSong (INT32 handle)
{
handle = 0;
if (nomidimusic)
if (midi_disabled)
return;
midi_pause();
songpaused = true;
@ -452,7 +452,7 @@ void I_PauseSong (INT32 handle)
void I_ResumeSong (INT32 handle)
{
handle = 0;
if (nomidimusic)
if (midi_disabled)
return;
midi_resume();
songpaused = false;
@ -461,7 +461,7 @@ void I_ResumeSong (INT32 handle)
void I_StopSong(void)
{
handle = 0;
if (nomidimusic)
if (midi_disabled)
return;
islooping = 0;
@ -474,7 +474,7 @@ void I_StopSong(void)
#if 0
int I_QrySongPlaying(int handle)
{
if (nomidimusic)
if (midi_disabled)
return 0;
//return islooping || musicdies > gametic;
@ -485,7 +485,7 @@ int I_QrySongPlaying(int handle)
void I_UnloadSong(void)
{
handle = 0;
if (nomidimusic)
if (midi_disabled)
return;
//destroy_midi(currsong);
@ -494,7 +494,7 @@ void I_UnloadSong(void)
boolean I_LoadSong(char *data, size_t len)
{
int e = len; //Alam: For error
if (nomidimusic)
if (midi_disabled)
return 0;
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 (nosound)
if (sound_disabled)
return -1;
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
{
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
else if (nosound) return;
else if (nomidimusic && nodigimusic
else if (sound_disabled) return;
else if (midi_disabled && digital_disabled
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#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
{
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
else if (nosound) return;
else if (nomidimusic && nodigimusic
else if (sound_disabled) return;
else if (midi_disabled && digital_disabled
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
#endif
@ -493,7 +493,7 @@ static inline void I_SetChannels(void)
INT32 *steptablemid = steptable + 128;
if (nosound)
if (sound_disabled)
return;
// 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)pitch;
if (nosound)
if (sound_disabled)
return 0;
if (S_sfx[id].data == NULL) return -1;
@ -1136,7 +1136,7 @@ static INT32 Init3DSDriver(const char *soName)
void I_ShutdownSound(void)
{
if (nosound || !sound_started)
if (sound_disabled || !sound_started)
return;
CONS_Printf("I_ShutdownSound: ");
@ -1150,7 +1150,7 @@ void I_ShutdownSound(void)
}
#endif
if (nomidimusic && nodigimusic)
if (midi_disabled && digital_disabled)
SDL_CloseAudio();
CONS_Printf("%s", M_GetText("shut down\n"));
sound_started = false;
@ -1170,7 +1170,7 @@ void I_StartupSound(void)
const char *sdrv_name = NULL;
#endif
#ifndef HAVE_MIXER
nomidimusic = nodigimusic = true;
midi_disabled = digital_disabled = true;
#endif
memset(channels, 0, sizeof (channels)); //Alam: Clean it
@ -1213,7 +1213,7 @@ void I_StartupSound(void)
audio.samples /= 2;
}
if (nosound)
if (sound_disabled)
return;
#ifdef HW3SOUND
@ -1261,7 +1261,7 @@ void I_StartupSound(void)
{
snddev_t snddev;
//nosound = true;
//sound_disabled = true;
//I_AddExitFunc(I_ShutdownSound);
snddev.bps = 16;
snddev.sample_rate = audio.freq;
@ -1288,7 +1288,7 @@ void I_StartupSound(void)
if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0)
{
CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
nosound = true;
sound_disabled = true;
return;
}
else
@ -1452,7 +1452,7 @@ static boolean LoadSong(void *data, size_t lumplength, size_t selectpos)
void I_ShutdownMusic(void)
{
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
if ((midi_disabled && digital_disabled) || !musicStarted)
return;
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)
{
CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError());
nomidimusic = nodigimusic = true;
midi_disabled = digital_disabled = true;
if (sound_started
#ifdef HW3SOUND
&& hws_mode == HWS_DEFAULT_MODE
@ -1553,7 +1553,7 @@ void I_InitMusic(void)
if (SDL_OpenAudio(&audio, NULL) < 0) //retry
{
CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
nosound = true;
sound_disabled = true;
sound_started = false;
}
else
@ -1588,7 +1588,7 @@ boolean I_PlaySong(INT32 handle, boolean looping)
{
(void)handle;
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted || !music[handle])
if (midi_disabled || !musicStarted || !music[handle])
return false;
#ifdef MIXER_POS
@ -1621,7 +1621,7 @@ void I_PauseSong(void)
(void)handle;
I_PauseGME();
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
if ((midi_disabled && digital_disabled) || !musicStarted)
return;
Mix_PauseMusic();
@ -1641,7 +1641,7 @@ void I_ResumeSong(void)
(void)handle;
I_ResumeGME();
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
if ((midi_disabled && digital_disabled) || !musicStarted)
return;
Mix_VolumeMusic(musicvol);
@ -1654,7 +1654,7 @@ void I_StopSong(void)
{
I_StopGME();
#ifdef HAVE_MIXER
if (nodigimusic)
if (digital_disabled)
return;
#ifdef MIXER_POS
@ -1676,7 +1676,7 @@ void I_UnloadSong(void)
{
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted)
if (midi_disabled || !musicStarted)
return;
Mix_HaltMusic();
@ -1695,7 +1695,7 @@ void I_UnloadSong(void)
boolean I_LoadSong(char *data, size_t len)
{
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted)
if (midi_disabled || !musicStarted)
return false;
if (!LoadSong(data, len, 0))
@ -1715,7 +1715,7 @@ boolean I_LoadSong(char *data, size_t len)
void I_SetMusicVolume(UINT8 volume)
{
#ifdef HAVE_MIXER
if ((nomidimusic && nodigimusic) || !musicStarted)
if ((midi_disabled && digital_disabled) || !musicStarted)
return;
if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
@ -1802,7 +1802,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
return true;
#ifdef HAVE_MIXER
if (nodigimusic)
if (digital_disabled)
return false;
snprintf(filename, sizeof filename, "o_%s", musicname);