mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
- fixed: THe Timidity player didn't close its temporary files and left them
behind because it couldn't delete them. - added a $MidiDevice option to SNDINFO which can either set the preferred MIDI device for a song to Timidity or Windows' standard MIDI device. The reason for this: About 80% of my MIDI music collection sounds better with Timidity and the other 20% with Windows' standard synth and I'd like to be able to use each with the one that sounds better. For MUS files you can also force the use of OPL playback. - added telefrag option to A_SpawnItemEx. SVN r545 (trunk)
This commit is contained in:
parent
d0c3ebb5c2
commit
e8875041ca
11 changed files with 76 additions and 16 deletions
|
@ -1,3 +1,16 @@
|
||||||
|
September 11, 2007 (Changes by Graf Zahl)
|
||||||
|
- fixed: The Timidity player didn't close its temporary files and left them
|
||||||
|
behind because it couldn't delete them.
|
||||||
|
- added a $MidiDevice option to SNDINFO which can either set the preferred
|
||||||
|
MIDI device for a song to Timidity or Windows' standard MIDI device.
|
||||||
|
The reason for this: About 80% of my MIDI music collection sounds better
|
||||||
|
with Timidity and the other 20% with Windows' standard synth and I'd like
|
||||||
|
to be able to use each with the one that sounds better. For MUS files you
|
||||||
|
can also force the use of OPL playback.
|
||||||
|
|
||||||
|
September 8, 2007 (Changes by Graf Zahl)
|
||||||
|
- added telefrag option to A_SpawnItemEx.
|
||||||
|
|
||||||
September 5, 2007 (Changes by Graf Zahl)
|
September 5, 2007 (Changes by Graf Zahl)
|
||||||
- Fixed: Several options while changing maps only worked for the regular exit
|
- Fixed: Several options while changing maps only worked for the regular exit
|
||||||
but caused problems when used with the secret exit. Rewrote the code to
|
but caused problems when used with the secret exit. Rewrote the code to
|
||||||
|
|
|
@ -141,6 +141,7 @@ enum SICommands
|
||||||
SI_Registered,
|
SI_Registered,
|
||||||
SI_ArchivePath,
|
SI_ArchivePath,
|
||||||
SI_MusicVolume,
|
SI_MusicVolume,
|
||||||
|
SI_MidiDevice,
|
||||||
SI_IfDoom,
|
SI_IfDoom,
|
||||||
SI_IfHeretic,
|
SI_IfHeretic,
|
||||||
SI_IfHexen,
|
SI_IfHexen,
|
||||||
|
@ -178,6 +179,9 @@ struct FSavedPlayerSoundInfo
|
||||||
bool alias;
|
bool alias;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This specifies whether Timidity or Windows playback is preferred for a certain song (only useful for Windows.)
|
||||||
|
MidiDeviceMap MidiDevices;
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
void S_StartNamedSound (AActor *ent, fixed_t *pt, int channel,
|
void S_StartNamedSound (AActor *ent, fixed_t *pt, int channel,
|
||||||
|
@ -231,6 +235,7 @@ static const char *SICommandStrings[] =
|
||||||
"$registered",
|
"$registered",
|
||||||
"$archivepath",
|
"$archivepath",
|
||||||
"$musicvolume",
|
"$musicvolume",
|
||||||
|
"$mididevice",
|
||||||
"$ifdoom",
|
"$ifdoom",
|
||||||
"$ifheretic",
|
"$ifheretic",
|
||||||
"$ifhexen",
|
"$ifhexen",
|
||||||
|
@ -1159,6 +1164,20 @@ static void S_AddSNDINFO (int lump)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SI_MidiDevice: {
|
||||||
|
SC_MustGetString();
|
||||||
|
FName nm = sc_String;
|
||||||
|
int tim;
|
||||||
|
SC_MustGetString();
|
||||||
|
if (SC_Compare("timidity")) tim = 1;
|
||||||
|
else if (SC_Compare("standard")) tim = 0;
|
||||||
|
else if (SC_Compare("opl")) tim = 2;
|
||||||
|
else if (SC_Compare("default")) tim = -1;
|
||||||
|
else SC_ScriptError("Unknown MIDI device %s\n", sc_String);
|
||||||
|
MidiDevices[nm]=tim;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case SI_IfDoom:
|
case SI_IfDoom:
|
||||||
if (gameinfo.gametype != GAME_Doom)
|
if (gameinfo.gametype != GAME_Doom)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1539,6 +1539,11 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
{
|
{
|
||||||
int lumpnum = -1;
|
int lumpnum = -1;
|
||||||
int offset, length;
|
int offset, length;
|
||||||
|
int device = -1;
|
||||||
|
|
||||||
|
|
||||||
|
int * devp = MidiDevices.CheckKey(FName(musicname));
|
||||||
|
if (devp != NULL) device = *devp;
|
||||||
|
|
||||||
if (!FileExists (musicname))
|
if (!FileExists (musicname))
|
||||||
{
|
{
|
||||||
|
@ -1588,13 +1593,11 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
{
|
{
|
||||||
mus_playing.handle = I_RegisterSong (lumpnum != -1 ?
|
mus_playing.handle = I_RegisterSong (lumpnum != -1 ?
|
||||||
Wads.GetWadFullName (Wads.GetLumpFile (lumpnum)) :
|
Wads.GetWadFullName (Wads.GetLumpFile (lumpnum)) :
|
||||||
musicname, NULL, offset, length);
|
musicname, NULL, offset, length, device);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// musiccache is used globally because otherwise I'd have to pass
|
mus_playing.handle = I_RegisterSong (NULL, &musiccache[0], -1, length, device);
|
||||||
// it as a parameter through several layers of code.
|
|
||||||
mus_playing.handle = I_RegisterSong (NULL, &musiccache[0], -1, length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,4 +274,8 @@ ReverbContainer *S_FindEnvironment (const char *name);
|
||||||
ReverbContainer *S_FindEnvironment (int id);
|
ReverbContainer *S_FindEnvironment (int id);
|
||||||
void S_AddEnvironment (ReverbContainer *settings);
|
void S_AddEnvironment (ReverbContainer *settings);
|
||||||
|
|
||||||
|
typedef TMap<FName, int> MidiDeviceMap;
|
||||||
|
|
||||||
|
extern MidiDeviceMap MidiDevices;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -208,7 +208,7 @@ void I_UnRegisterSong (void *handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *I_RegisterSong (const char *filename, char * musiccache, int offset, int len)
|
void *I_RegisterSong (const char *filename, char * musiccache, int offset, int len, int device)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
MusInfo *info = NULL;
|
MusInfo *info = NULL;
|
||||||
|
@ -254,18 +254,27 @@ void *I_RegisterSong (const char *filename, char * musiccache, int offset, int l
|
||||||
// Check for MUS format
|
// Check for MUS format
|
||||||
if (id == MAKE_ID('M','U','S',0x1a))
|
if (id == MAKE_ID('M','U','S',0x1a))
|
||||||
{
|
{
|
||||||
if (GSnd != NULL && opl_enable)
|
if (GSnd != NULL && device != 0 && device != 1 && (opl_enable || device == 2) )
|
||||||
{
|
{
|
||||||
info = new OPLMUSSong (file, musiccache, len);
|
info = new OPLMUSSong (file, musiccache, len);
|
||||||
}
|
}
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (snd_mididevice != -2)
|
if (device == 1 && GSnd != NULL)
|
||||||
|
{
|
||||||
|
info = new TimiditySong (file, musiccache, len);
|
||||||
|
if (!info->IsValid())
|
||||||
|
{
|
||||||
|
delete info;
|
||||||
|
info = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info == NULL && (snd_mididevice != -2 || device == 0))
|
||||||
{
|
{
|
||||||
info = new MUSSong2 (file, musiccache, len);
|
info = new MUSSong2 (file, musiccache, len);
|
||||||
}
|
}
|
||||||
else if (GSnd != NULL)
|
else if (info == NULL && GSnd != NULL)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
{
|
{
|
||||||
info = new TimiditySong (file, musiccache, len);
|
info = new TimiditySong (file, musiccache, len);
|
||||||
|
@ -277,11 +286,20 @@ void *I_RegisterSong (const char *filename, char * musiccache, int offset, int l
|
||||||
{
|
{
|
||||||
// This is a midi file
|
// This is a midi file
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (snd_mididevice != -2)
|
if (device == 1 && GSnd != NULL)
|
||||||
|
{
|
||||||
|
info = new TimiditySong (file, musiccache, len);
|
||||||
|
if (!info->IsValid())
|
||||||
|
{
|
||||||
|
delete info;
|
||||||
|
info = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info == NULL && (snd_mididevice != -2 || device == 0))
|
||||||
{
|
{
|
||||||
info = new MIDISong2 (file, musiccache, len);
|
info = new MIDISong2 (file, musiccache, len);
|
||||||
}
|
}
|
||||||
else if (GSnd != NULL)
|
else if (info == NULL && GSnd != NULL)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
{
|
{
|
||||||
info = new TimiditySong (file, musiccache, len);
|
info = new TimiditySong (file, musiccache, len);
|
||||||
|
|
|
@ -53,7 +53,7 @@ void I_PauseSong (void *handle);
|
||||||
void I_ResumeSong (void *handle);
|
void I_ResumeSong (void *handle);
|
||||||
|
|
||||||
// Registers a song handle to song data.
|
// Registers a song handle to song data.
|
||||||
void *I_RegisterSong (const char *file, char * musiccache, int offset, int length);
|
void *I_RegisterSong (const char *file, char * musiccache, int offset, int length, int device);
|
||||||
void *I_RegisterCDSong (int track, int cdid = 0);
|
void *I_RegisterCDSong (int track, int cdid = 0);
|
||||||
|
|
||||||
// Called by anything that wishes to start music.
|
// Called by anything that wishes to start music.
|
||||||
|
|
|
@ -176,7 +176,7 @@ void MIDISong2::Play (bool looping)
|
||||||
|
|
||||||
// Find out if this an FM synth or not for EMIDI
|
// Find out if this an FM synth or not for EMIDI
|
||||||
DesignationMask = 0xFF0F;
|
DesignationMask = 0xFF0F;
|
||||||
if (MMSYSERR_NOERROR == midiOutGetDevCaps (mididevice, &caps, sizeof(caps)))
|
if (MMSYSERR_NOERROR == midiOutGetDevCaps (mididevice<0? MIDI_MAPPER:mididevice, &caps, sizeof(caps)))
|
||||||
{
|
{
|
||||||
if (caps.wTechnology == MOD_FMSYNTH)
|
if (caps.wTechnology == MOD_FMSYNTH)
|
||||||
{
|
{
|
||||||
|
@ -188,7 +188,7 @@ void MIDISong2::Play (bool looping)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MMSYSERR_NOERROR != midiOutOpen (&MidiOut, mididevice, 0, 0, CALLBACK_NULL))
|
if (MMSYSERR_NOERROR != midiOutOpen (&MidiOut, mididevice<0? MIDI_MAPPER:mididevice, 0, 0, CALLBACK_NULL))
|
||||||
{
|
{
|
||||||
Printf (PRINT_BOLD, "Could not open MIDI out device\n");
|
Printf (PRINT_BOLD, "Could not open MIDI out device\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -213,9 +213,9 @@ TimiditySong::TimiditySong (FILE *file, char * musiccache, int len)
|
||||||
{
|
{
|
||||||
success = ProduceMIDI (buf, f);
|
success = ProduceMIDI (buf, f);
|
||||||
}
|
}
|
||||||
|
fclose (f);
|
||||||
if (file!=NULL)
|
if (file!=NULL)
|
||||||
{
|
{
|
||||||
fclose (f);
|
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ void MUSSong2::Play (bool looping)
|
||||||
m_Status = STATE_Stopped;
|
m_Status = STATE_Stopped;
|
||||||
m_Looping = looping;
|
m_Looping = looping;
|
||||||
|
|
||||||
if (MMSYSERR_NOERROR != midiOutOpen (&MidiOut, mididevice, 0, 0, CALLBACK_NULL))
|
if (MMSYSERR_NOERROR != midiOutOpen (&MidiOut, mididevice<0? MIDI_MAPPER:mididevice, 0, 0, CALLBACK_NULL))
|
||||||
{
|
{
|
||||||
Printf (PRINT_BOLD, "Could not open MIDI out device\n");
|
Printf (PRINT_BOLD, "Could not open MIDI out device\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1451,7 +1451,8 @@ enum SIX_Flags
|
||||||
SIXF_ABSOLUTEANGLE=4,
|
SIXF_ABSOLUTEANGLE=4,
|
||||||
SIXF_ABSOLUTEMOMENTUM=8,
|
SIXF_ABSOLUTEMOMENTUM=8,
|
||||||
SIXF_SETMASTER=16,
|
SIXF_SETMASTER=16,
|
||||||
SIXF_NOCHECKPOSITION=32
|
SIXF_NOCHECKPOSITION=32,
|
||||||
|
SIXF_TELEFRAG=64
|
||||||
};
|
};
|
||||||
|
|
||||||
void A_SpawnItemEx(AActor * self)
|
void A_SpawnItemEx(AActor * self)
|
||||||
|
@ -1520,6 +1521,7 @@ void A_SpawnItemEx(AActor * self)
|
||||||
mo->momy=ymom;
|
mo->momy=ymom;
|
||||||
mo->momz=zmom;
|
mo->momz=zmom;
|
||||||
mo->angle=Angle;
|
mo->angle=Angle;
|
||||||
|
if (flags & SIXF_TELEFRAG) P_TeleportMove(mo, mo->x, mo->y, mo->z, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ const int SXF_ABSOLUTEANGLE=4;
|
||||||
const int SXF_ABSOLUTEMOMENTUM=8;
|
const int SXF_ABSOLUTEMOMENTUM=8;
|
||||||
const int SXF_SETMASTER=16;
|
const int SXF_SETMASTER=16;
|
||||||
const int SXF_NOCHECKPOSITION = 32;
|
const int SXF_NOCHECKPOSITION = 32;
|
||||||
|
const int SXF_TELEFRAG=64;
|
||||||
|
|
||||||
// Flags for A_Chase
|
// Flags for A_Chase
|
||||||
const int CHF_FASTCHASE = 1;
|
const int CHF_FASTCHASE = 1;
|
||||||
|
|
Loading…
Reference in a new issue