- fixed: XMI music files were not converted for playback with FMod or Timidity++.

- Was there any reason why the MIDI_GUS device was so well hidden from the user? It sure does not sound broken. Added it to MIDI menu and $mididevice.


SVN r2862 (trunk)
This commit is contained in:
Christoph Oelckers 2010-09-29 00:35:47 +00:00
parent 6014250f3a
commit e2c105b447
4 changed files with 40 additions and 43 deletions

View File

@ -1295,6 +1295,7 @@ static void S_AddSNDINFO (int lump)
else if (sc.Compare("opl")) MidiDevices[nm] = MDEV_OPL; else if (sc.Compare("opl")) MidiDevices[nm] = MDEV_OPL;
else if (sc.Compare("default")) MidiDevices[nm] = MDEV_DEFAULT; else if (sc.Compare("default")) MidiDevices[nm] = MDEV_DEFAULT;
else if (sc.Compare("fluidsynth")) MidiDevices[nm] = MDEV_FLUIDSYNTH; else if (sc.Compare("fluidsynth")) MidiDevices[nm] = MDEV_FLUIDSYNTH;
else if (sc.Compare("gus")) MidiDevices[nm] = MDEV_GUS;
else sc.ScriptError("Unknown MIDI device %s\n", sc.String); else sc.ScriptError("Unknown MIDI device %s\n", sc.String);
} }
break; break;

View File

@ -379,6 +379,7 @@ enum EMidiDevice
MDEV_FMOD = 2, MDEV_FMOD = 2,
MDEV_TIMIDITY = 3, MDEV_TIMIDITY = 3,
MDEV_FLUIDSYNTH = 4, MDEV_FLUIDSYNTH = 4,
MDEV_GUS = 5,
}; };
typedef TMap<FName, int> MidiDeviceMap; typedef TMap<FName, int> MidiDeviceMap;

View File

@ -527,7 +527,7 @@ MusInfo *I_RegisterSong (const char *filename, BYTE *musiccache, int offset, int
{ {
devtype = MIDI_OPL; devtype = MIDI_OPL;
} }
else if (snd_mididevice == -4 && device == MDEV_DEFAULT) else if (device == MDEV_GUS || (snd_mididevice == -4 && device == MDEV_DEFAULT))
{ {
devtype = MIDI_GUS; devtype = MIDI_GUS;
} }
@ -554,6 +554,10 @@ retry_as_fmod:
{ {
streamer = new MUSSong2(file, musiccache, len, MIDI_Null); streamer = new MUSSong2(file, musiccache, len, MIDI_Null);
} }
else if (miditype == MIDI_XMI)
{
streamer = new XMISong(file, musiccache, len, MIDI_Null);
}
else else
{ {
assert(miditype == MIDI_HMI); assert(miditype == MIDI_HMI);

View File

@ -10,6 +10,34 @@
static DWORD nummididevices; static DWORD nummididevices;
static bool nummididevicesset; static bool nummididevicesset;
#ifdef HAVE_FLUIDSYNTH
#define NUM_DEF_DEVICES 5
#else
#define NUM_DEF_DEVICES 4
#endif
static void AddDefaultMidiDevices(FOptionValues *opt)
{
int p;
FOptionValues::Pair *pair = &opt->mValues[opt->mValues.Reserve(NUM_DEF_DEVICES)];
#ifdef HAVE_FLUIDSYNTH
pair[0].Text = "FluidSynth";
pair[0].Value = -5.0;
p = 1;
#else
p = 0;
#endif
pair[p].Text = "GUS";
pair[p].Value = -4.0;
pair[p+1].Text = "OPL Synth Emulation";
pair[p+1].Value = -3.0;
pair[p+2].Text = "TiMidity++";
pair[p+2].Value = -2.0;
pair[p+3].Text = "FMOD";
pair[p+3].Value = -1.0;
}
#ifdef _WIN32 #ifdef _WIN32
UINT mididevice; UINT mididevice;
@ -71,29 +99,9 @@ void I_ShutdownMusicWin32 ()
} }
} }
#ifdef HAVE_FLUIDSYNTH
#define NUM_DEF_DEVICES 4
#else
#define NUM_DEF_DEVICES 3
#endif
void I_BuildMIDIMenuList (FOptionValues *opt) void I_BuildMIDIMenuList (FOptionValues *opt)
{ {
int p; AddDefaultMidiDevices(opt);
FOptionValues::Pair *pair = &opt->mValues[opt->mValues.Reserve(NUM_DEF_DEVICES)];
#ifdef HAVE_FLUIDSYNTH
pair[0].Text = "FluidSynth";
pair[0].Value = -5.0;
p = 1;
#else
p = 0;
#endif
pair[p].Text = "OPL Synth Emulation";
pair[p].Value = -3.0;
pair[p+1].Text = "TiMidity++";
pair[p+1].Value = -2.0;
pair[p+2].Text = "FMOD";
pair[p+2].Value = -1.0;
for (DWORD id = 0; id < nummididevices; ++id) for (DWORD id = 0; id < nummididevices; ++id)
{ {
@ -104,7 +112,7 @@ void I_BuildMIDIMenuList (FOptionValues *opt)
assert(res == MMSYSERR_NOERROR); assert(res == MMSYSERR_NOERROR);
if (res == MMSYSERR_NOERROR) if (res == MMSYSERR_NOERROR)
{ {
pair = &opt->mValues[opt->mValues.Reserve(1)]; FOptionValues::Pair *pair = &opt->mValues[opt->mValues.Reserve(1)];
pair->Text = caps.szPname; pair->Text = caps.szPname;
pair->Value = (float)id; pair->Value = (float)id;
} }
@ -156,6 +164,7 @@ CCMD (snd_listmididevices)
#ifdef HAVE_FLUIDSYNTH #ifdef HAVE_FLUIDSYNTH
PrintMidiDevice (-5, "FluidSynth", MOD_SWSYNTH, 0); PrintMidiDevice (-5, "FluidSynth", MOD_SWSYNTH, 0);
#endif #endif
PrintMidiDevice (-4, "GUS", 0, MOD_SWSYNTH);
PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0); PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0);
PrintMidiDevice (-2, "TiMidity++", 0, MOD_SWSYNTH); PrintMidiDevice (-2, "TiMidity++", 0, MOD_SWSYNTH);
PrintMidiDevice (-1, "FMOD", 0, MOD_SWSYNTH); PrintMidiDevice (-1, "FMOD", 0, MOD_SWSYNTH);
@ -188,28 +197,9 @@ CUSTOM_CVAR(Int, snd_mididevice, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
self = -1; self = -1;
} }
#ifdef HAVE_FLUIDSYNTH
#define NUM_DEF_DEVICES 4
#else
#define NUM_DEF_DEVICES 3
#endif
void I_BuildMIDIMenuList (FOptionValues *opt) void I_BuildMIDIMenuList (FOptionValues *opt)
{ {
int p; AddDefaultMidiDevices(opt);
FOptionValues::Pair *pair = &opt->mValues[opt->mValues.Reserve(NUM_DEF_DEVICES)];
#ifdef HAVE_FLUIDSYNTH
pair[0].Text = "FluidSynth";
pair[0].Value = -5.0;
p = 1;
#else
p = 0;
#endif
pair[p].Text = "OPL Synth Emulation";
pair[p].Value = -3.0;
pair[p+1].Text = "TiMidity++";
pair[p+1].Value = -2.0;
pair[p+2].Text = "FMOD";
pair[p+2].Value = -1.0;
} }
CCMD (snd_listmididevices) CCMD (snd_listmididevices)
@ -217,6 +207,7 @@ CCMD (snd_listmididevices)
#ifdef HAVE_FLUIDSYNTH #ifdef HAVE_FLUIDSYNTH
Printf("%s-5. FluidSynth\n", -5 == snd_mididevice ? TEXTCOLOR_BOLD : ""); Printf("%s-5. FluidSynth\n", -5 == snd_mididevice ? TEXTCOLOR_BOLD : "");
#endif #endif
Printf("%s-4. GUS\n", -4 == snd_mididevice ? TEXTCOLOR_BOLD : "");
Printf("%s-3. Emulated OPL FM Synth\n", -3 == snd_mididevice ? TEXTCOLOR_BOLD : ""); Printf("%s-3. Emulated OPL FM Synth\n", -3 == snd_mididevice ? TEXTCOLOR_BOLD : "");
Printf("%s-2. TiMidity++\n", -2 == snd_mididevice ? TEXTCOLOR_BOLD : ""); Printf("%s-2. TiMidity++\n", -2 == snd_mididevice ? TEXTCOLOR_BOLD : "");
Printf("%s-1. FMOD\n", -1 == snd_mididevice ? TEXTCOLOR_BOLD : ""); Printf("%s-1. FMOD\n", -1 == snd_mididevice ? TEXTCOLOR_BOLD : "");