mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-27 13:31:43 +00:00
Kill MIDI more >:)
This commit is contained in:
parent
72e225f8c9
commit
aedc5ae7af
7 changed files with 25 additions and 74 deletions
|
|
@ -24,7 +24,6 @@ typedef enum {
|
|||
MU_CMD,
|
||||
MU_WAV,
|
||||
MU_MOD,
|
||||
MU_MID,
|
||||
MU_OGG,
|
||||
MU_MP3,
|
||||
MU_MP3_MAD_UNUSED, // use MU_MP3 instead
|
||||
|
|
|
|||
|
|
@ -1959,8 +1959,6 @@ static int lib_sMusicInfo(lua_State *L)
|
|||
|
||||
static int lib_sMusicExists(lua_State *L)
|
||||
{
|
||||
boolean checkMIDI = lua_opttrueboolean(L, 2);
|
||||
boolean checkDigi = lua_opttrueboolean(L, 3);
|
||||
#ifdef MUSICSLOT_COMPATIBILITY
|
||||
const char *music_name;
|
||||
UINT32 music_num;
|
||||
|
|
@ -1989,7 +1987,7 @@ static int lib_sMusicExists(lua_State *L)
|
|||
const char *music_name = luaL_checkstring(L, 1);
|
||||
#endif
|
||||
NOHUD
|
||||
lua_pushboolean(L, S_MusicExists(music_name, checkMIDI, checkDigi));
|
||||
lua_pushboolean(L, S_MusicExists(music_name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1771,7 +1771,7 @@ boolean S_DigMusicDisabled(void)
|
|||
|
||||
boolean S_MusicDisabled(void)
|
||||
{
|
||||
return (midi_disabled && digital_disabled);
|
||||
return digital_disabled;
|
||||
}
|
||||
|
||||
boolean S_MusicPlaying(void)
|
||||
|
|
@ -1807,12 +1807,9 @@ boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping)
|
|||
return (boolean)mname[0];
|
||||
}
|
||||
|
||||
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi)
|
||||
boolean S_MusicExists(const char *mname)
|
||||
{
|
||||
return (
|
||||
(checkDigi ? W_CheckNumForName(va("O_%s", mname)) != LUMPERROR : false)
|
||||
|| (checkMIDI ? W_CheckNumForName(va("D_%s", mname)) != LUMPERROR : false)
|
||||
);
|
||||
return W_CheckNumForName(va("O_%s", mname)) != LUMPERROR;
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
|
|
@ -1867,8 +1864,6 @@ static boolean S_LoadMusic(const char *mname)
|
|||
|
||||
if (!S_DigMusicDisabled() && S_DigExists(mname))
|
||||
mlumpnum = W_GetNumForName(va("o_%s", mname));
|
||||
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||
mlumpnum = W_GetNumForName(va("d_%s", mname));
|
||||
else if (S_DigMusicDisabled() && S_DigExists(mname))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n");
|
||||
|
|
@ -2356,25 +2351,7 @@ void GameDigiMusic_OnChange(void)
|
|||
else
|
||||
{
|
||||
digital_disabled = true;
|
||||
if (S_MusicType() != MU_MID)
|
||||
{
|
||||
if (midi_disabled)
|
||||
S_StopMusic();
|
||||
else
|
||||
{
|
||||
char mmusic[7];
|
||||
UINT16 mflags;
|
||||
boolean looping;
|
||||
|
||||
if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
|
||||
{
|
||||
S_StopMusic();
|
||||
S_ChangeMusic(mmusic, mflags, looping);
|
||||
}
|
||||
else
|
||||
S_StopMusic();
|
||||
}
|
||||
}
|
||||
S_StopMusic();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,16 +118,14 @@ void S_StopSound(void *origin);
|
|||
//
|
||||
|
||||
boolean S_DigMusicDisabled(void);
|
||||
boolean S_MIDIMusicDisabled(void);
|
||||
boolean S_MusicDisabled(void);
|
||||
boolean S_MusicPlaying(void);
|
||||
boolean S_MusicPaused(void);
|
||||
musictype_t S_MusicType(void);
|
||||
const char *S_MusicName(void);
|
||||
boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping);
|
||||
boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
|
||||
#define S_DigExists(a) S_MusicExists(a, false, true)
|
||||
#define S_MIDIExists(a) S_MusicExists(a, true, false)
|
||||
boolean S_MusicExists(const char *mname);
|
||||
#define S_DigExists S_MusicExists
|
||||
|
||||
//
|
||||
// Music Effects
|
||||
|
|
|
|||
|
|
@ -536,13 +536,6 @@ void I_SetSfxVolume(int volume)
|
|||
|
||||
static UINT32 get_real_volume(int volume)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (I_SongType() == MU_MID)
|
||||
// HACK: Until we stop using native MIDI,
|
||||
// disable volume changes
|
||||
return ((UINT32)31*128/31); // volume = 31
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// convert volume to mixer's 128 scale
|
||||
// then apply internal_volume as a percentage
|
||||
|
|
@ -611,7 +604,7 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata)
|
|||
(void)stream;
|
||||
(void)udata;
|
||||
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD)
|
||||
return;
|
||||
music_bytes += len;
|
||||
|
||||
|
|
@ -714,8 +707,6 @@ musictype_t I_SongType(void)
|
|||
#endif
|
||||
if (!music)
|
||||
return MU_NONE;
|
||||
else if (Mix_GetMusicType(music) == MUS_MID)
|
||||
return MU_MID;
|
||||
else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG)
|
||||
return MU_MOD;
|
||||
else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD)
|
||||
|
|
@ -798,7 +789,7 @@ UINT32 I_GetSongLength(void)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
if (!music || I_SongType() == MU_MOD)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
|
|
@ -813,7 +804,7 @@ UINT32 I_GetSongLength(void)
|
|||
|
||||
boolean I_SetSongLoopPoint(UINT32 looppoint)
|
||||
{
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID || !is_looping)
|
||||
if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || !is_looping)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
|
|
@ -849,7 +840,7 @@ UINT32 I_GetSongLoopPoint(void)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MOD || I_SongType() == MU_MID)
|
||||
if (!music || I_SongType() == MU_MOD)
|
||||
return 0;
|
||||
else
|
||||
return (UINT32)(loop_point * 1000);
|
||||
|
|
@ -883,7 +874,7 @@ boolean I_SetSongPosition(UINT32 position)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MID)
|
||||
if (!music)
|
||||
return false;
|
||||
else if (I_SongType() == MU_MOD)
|
||||
return Mix_SetMusicPosition(position); // Goes by channels
|
||||
|
|
@ -942,7 +933,7 @@ UINT32 I_GetSongPosition(void)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if (!music || I_SongType() == MU_MID)
|
||||
if (!music)
|
||||
return 0;
|
||||
else
|
||||
return music_bytes/44100.0L*1000.0L/4; //assume 44.1khz
|
||||
|
|
@ -1170,12 +1161,12 @@ boolean I_PlaySong(boolean looping)
|
|||
if (fpclassify(song_length) == FP_ZERO && (I_SongType() == MU_OGG || I_SongType() == MU_MP3 || I_SongType() == MU_FLAC))
|
||||
CONS_Debug(DBG_DETAILED, "This song is missing a LENGTHMS= tag! Required to make seeking work properly.\n");
|
||||
|
||||
if (I_SongType() != MU_MOD && I_SongType() != MU_MID && Mix_PlayMusic(music, 0) == -1)
|
||||
if (I_SongType() != MU_MOD && Mix_PlayMusic(music, 0) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||
return false;
|
||||
}
|
||||
else if ((I_SongType() == MU_MOD || I_SongType() == MU_MID) && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
|
||||
else if (I_SongType() == MU_MOD && Mix_PlayMusic(music, looping ? -1 : 0) == -1) // if MOD, loop forever
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
|
||||
return false;
|
||||
|
|
@ -1185,10 +1176,10 @@ boolean I_PlaySong(boolean looping)
|
|||
|
||||
I_SetMusicVolume(music_volume);
|
||||
|
||||
if (I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
if (I_SongType() != MU_MOD)
|
||||
Mix_HookMusicFinished(music_loop); // don't bother counting if MOD
|
||||
|
||||
if(I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
if(I_SongType() != MU_MOD && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
|
||||
|
||||
return true;
|
||||
|
|
@ -1217,10 +1208,9 @@ void I_StopSong(void)
|
|||
|
||||
void I_PauseSong(void)
|
||||
{
|
||||
if(I_SongType() == MU_MID) // really, SDL Mixer? why can't you pause MIDI???
|
||||
return;
|
||||
// really, SRB2? why do you support MIDI???
|
||||
|
||||
if(I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
if(I_SongType() != MU_GME && I_SongType() != MU_MOD)
|
||||
Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes);
|
||||
|
||||
Mix_PauseMusic();
|
||||
|
|
@ -1229,15 +1219,12 @@ void I_PauseSong(void)
|
|||
|
||||
void I_ResumeSong(void)
|
||||
{
|
||||
if (I_SongType() == MU_MID)
|
||||
return;
|
||||
|
||||
if (I_SongType() != MU_GME && I_SongType() != MU_MOD && I_SongType() != MU_MID)
|
||||
if (I_SongType() != MU_GME && I_SongType() != MU_MOD)
|
||||
{
|
||||
while(Mix_UnregisterEffect(MIX_CHANNEL_POST, count_music_bytes) != 0) { }
|
||||
// HACK: fixes issue of multiple effect callbacks being registered
|
||||
|
||||
if(music && I_SongType() != MU_MOD && I_SongType() != MU_MID && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
if(music && I_SongType() != MU_MOD && !Mix_RegisterEffect(MIX_CHANNEL_POST, count_music_bytes, NULL, NULL))
|
||||
CONS_Alert(CONS_WARNING, "Error registering SDL music position counter: %s\n", Mix_GetError());
|
||||
}
|
||||
|
||||
|
|
@ -1250,14 +1237,7 @@ void I_SetMusicVolume(int volume)
|
|||
if (!I_SongPlaying())
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (I_SongType() == MU_MID)
|
||||
// HACK: Until we stop using native MIDI,
|
||||
// disable volume changes
|
||||
music_volume = 31;
|
||||
else
|
||||
#endif
|
||||
music_volume = volume;
|
||||
music_volume = volume;
|
||||
|
||||
Mix_VolumeMusic(get_real_volume(music_volume));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio call
|
|||
{
|
||||
if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
|
||||
else if (sound_disabled) return;
|
||||
else if (midi_disabled && digital_disabled
|
||||
else if (digital_disabled
|
||||
#ifdef HW3SOUND
|
||||
&& hws_mode == HWS_DEFAULT_MODE
|
||||
#endif
|
||||
|
|
@ -209,7 +209,7 @@ static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio
|
|||
{
|
||||
if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
|
||||
else if (sound_disabled) return;
|
||||
else if (midi_disabled && digital_disabled
|
||||
else if (digital_disabled
|
||||
#ifdef HW3SOUND
|
||||
&& hws_mode == HWS_DEFAULT_MODE
|
||||
#endif
|
||||
|
|
@ -1153,7 +1153,7 @@ void I_ShutdownSound(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (midi_disabled && digital_disabled)
|
||||
if (digital_disabled)
|
||||
SDL_CloseAudio();
|
||||
CONS_Printf("%s", M_GetText("shut down\n"));
|
||||
sound_started = false;
|
||||
|
|
|
|||
|
|
@ -1707,7 +1707,6 @@ int W_VerifyNMUSlumps(const char *filename)
|
|||
{
|
||||
lumpchecklist_t NMUSlist[] =
|
||||
{
|
||||
{"D_", 2}, // MIDI music
|
||||
{"O_", 2}, // Digital music
|
||||
{"DS", 2}, // Sound effects
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue