mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- WildMidi generally working, some cleanup left to do...
This commit is contained in:
parent
eff2286bc9
commit
a03b947729
6 changed files with 34 additions and 5 deletions
|
@ -1080,6 +1080,7 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE
|
|||
sound/music_midistream.cpp
|
||||
sound/music_midi_base.cpp
|
||||
sound/music_midi_timidity.cpp
|
||||
sound/music_midi_wildmidi.cpp
|
||||
sound/music_mus_opl.cpp
|
||||
sound/music_stream.cpp
|
||||
sound/music_fluidsynth_mididevice.cpp
|
||||
|
|
|
@ -1372,6 +1372,7 @@ static void S_AddSNDINFO (int lump)
|
|||
else if (sc.Compare("default")) MidiDevices[nm] = MDEV_DEFAULT;
|
||||
else if (sc.Compare("fluidsynth")) MidiDevices[nm] = MDEV_FLUIDSYNTH;
|
||||
else if (sc.Compare("gus")) MidiDevices[nm] = MDEV_GUS;
|
||||
else if (sc.Compare("wildmidi")) MidiDevices[nm] = MDEV_WILDMIDI;
|
||||
else sc.ScriptError("Unknown MIDI device %s\n", sc.String);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -394,6 +394,7 @@ enum EMidiDevice
|
|||
MDEV_TIMIDITY = 3,
|
||||
MDEV_FLUIDSYNTH = 4,
|
||||
MDEV_GUS = 5,
|
||||
MDEV_WILDMIDI = 6,
|
||||
};
|
||||
|
||||
typedef TMap<FName, FName> MusicAliasMap;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "i_music.h"
|
||||
#include "s_sound.h"
|
||||
#include "files.h"
|
||||
#include "wildmidi/wildmidi_lib.h"
|
||||
|
||||
void I_InitMusicWin32 ();
|
||||
void I_ShutdownMusicWin32 ();
|
||||
|
@ -218,6 +219,24 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
class WildMidiMIDIDevice : public PseudoMIDIDevice
|
||||
{
|
||||
public:
|
||||
WildMidiMIDIDevice();
|
||||
~WildMidiMIDIDevice();
|
||||
|
||||
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
||||
bool Preprocess(MIDIStreamer *song, bool looping);
|
||||
bool IsOpen() const;
|
||||
|
||||
protected:
|
||||
|
||||
midi *mMidi;
|
||||
bool mLoop;
|
||||
|
||||
static bool FillStream(SoundStream *stream, void *buff, int len, void *userdata);
|
||||
};
|
||||
|
||||
|
||||
// Base class for software synthesizer MIDI output devices ------------------
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ static DWORD nummididevices;
|
|||
static bool nummididevicesset;
|
||||
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
#define NUM_DEF_DEVICES 5
|
||||
#define NUM_DEF_DEVICES 6
|
||||
#else
|
||||
#define NUM_DEF_DEVICES 4
|
||||
#define NUM_DEF_DEVICES 5
|
||||
#endif
|
||||
|
||||
static void AddDefaultMidiDevices(FOptionValues *opt)
|
||||
|
@ -33,8 +33,10 @@ static void AddDefaultMidiDevices(FOptionValues *opt)
|
|||
pair[p+1].Value = -3.0;
|
||||
pair[p+2].Text = "TiMidity++";
|
||||
pair[p+2].Value = -2.0;
|
||||
pair[p+3].Text = "Sound System";
|
||||
pair[p+3].Value = -1.0;
|
||||
pair[p+3].Text = "WildMidi";
|
||||
pair[p+3].Value = -6.0;
|
||||
pair[p+4].Text = "Sound System";
|
||||
pair[p+4].Value = -1.0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,7 @@ CUSTOM_CVAR (Int, snd_mididevice, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
if (!nummididevicesset)
|
||||
return;
|
||||
|
||||
if ((self >= (signed)nummididevices) || (self < -5))
|
||||
if ((self >= (signed)nummididevices) || (self < -6))
|
||||
{
|
||||
Printf ("ID out of range. Using default device.\n");
|
||||
self = 0;
|
||||
|
@ -211,6 +213,7 @@ void I_BuildMIDIMenuList (FOptionValues *opt)
|
|||
|
||||
CCMD (snd_listmididevices)
|
||||
{
|
||||
Printf("%s-6. WildMidi\n", -6 == snd_mididevice ? TEXTCOLOR_BOLD : "");
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
Printf("%s-5. FluidSynth\n", -5 == snd_mididevice ? TEXTCOLOR_BOLD : "");
|
||||
#endif
|
||||
|
|
|
@ -240,6 +240,7 @@ EMidiDevice MIDIStreamer::SelectMIDIDevice(EMidiDevice device)
|
|||
#ifdef HAVE_FLUIDSYNTH
|
||||
case -5: return MDEV_FLUIDSYNTH;
|
||||
#endif
|
||||
case -6: return MDEV_WILDMIDI;
|
||||
default:
|
||||
#ifdef _WIN32
|
||||
return MDEV_MMAPI;
|
||||
|
@ -292,6 +293,9 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype) const
|
|||
case MDEV_TIMIDITY:
|
||||
return new TimidityPPMIDIDevice;
|
||||
|
||||
case MDEV_WILDMIDI:
|
||||
return new WildMidiMIDIDevice;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue