- fixed: Do not pass Sysex messages to Windows's GS Wavetable synth.

This will totally refuse to play a MIDI if that happens.
Duke Nukem's Alienz.mid, which did not play before works after this change.
This commit is contained in:
Christoph Oelckers 2018-11-01 10:22:21 +01:00
parent f7ce4dd2da
commit c5153ca095
7 changed files with 14 additions and 3 deletions

View file

@ -82,6 +82,7 @@ public:
virtual bool Preprocess(MIDIStreamer *song, bool looping); virtual bool Preprocess(MIDIStreamer *song, bool looping);
virtual FString GetStats(); virtual FString GetStats();
virtual int GetDeviceType() const { return MDEV_DEFAULT; } virtual int GetDeviceType() const { return MDEV_DEFAULT; }
virtual bool CanHandleSysex() const { return true; }
}; };

View file

@ -86,6 +86,12 @@ public:
bool Update() override; bool Update() override;
void PrecacheInstruments(const uint16_t *instruments, int count); void PrecacheInstruments(const uint16_t *instruments, int count);
DWORD PlayerLoop(); DWORD PlayerLoop();
bool CanHandleSysex() const override
{
// No Sysex for GS synth.
return VolumeWorks;
}
//protected: //protected:
static void CALLBACK CallbackFunc(HMIDIOUT, UINT, DWORD_PTR, DWORD, DWORD); static void CALLBACK CallbackFunc(HMIDIOUT, UINT, DWORD_PTR, DWORD, DWORD);

View file

@ -25,6 +25,7 @@ class MIDISource
protected: protected:
bool isLooping = false; bool isLooping = false;
bool skipSysex = false;
int Division = 0; int Division = 0;
int Tempo = 500000; int Tempo = 500000;
int InitialTempo = 500000; int InitialTempo = 500000;
@ -54,6 +55,8 @@ public:
LoopLimit = looplimit; LoopLimit = looplimit;
isLooping = looped; isLooping = looped;
} }
void SkipSysex() { skipSysex = true; }
bool isValid() const { return Division > 0; } bool isValid() const { return Division > 0; }
int getDivision() const { return Division; } int getDivision() const { return Division; }

View file

@ -644,7 +644,7 @@ uint32_t *HMISong::SendCommand (uint32_t *events, TrackInfo *track, uint32_t del
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = ReadVarLen(track); len = ReadVarLen(track);
if (len >= (MAX_MIDI_EVENTS-1)*3*4) if (len >= (MAX_MIDI_EVENTS-1)*3*4 || skipSysex)
{ // This message will never fit. Throw it away. { // This message will never fit. Throw it away.
track->TrackP += len; track->TrackP += len;
} }

View file

@ -585,7 +585,7 @@ uint32_t *MIDISong2::SendCommand (uint32_t *events, TrackInfo *track, uint32_t d
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = track->ReadVarLen(); len = track->ReadVarLen();
if (len >= (MAX_MIDI_EVENTS-1)*3*4) if (len >= (MAX_MIDI_EVENTS-1)*3*4 || skipSysex)
{ // This message will never fit. Throw it away. { // This message will never fit. Throw it away.
track->TrackP += len; track->TrackP += len;
} }

View file

@ -515,7 +515,7 @@ uint32_t *XMISong::SendCommand (uint32_t *events, EventSource due, uint32_t dela
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = track->ReadVarLen(); len = track->ReadVarLen();
if (len >= (MAX_MIDI_EVENTS-1)*3*4) if (len >= (MAX_MIDI_EVENTS-1)*3*4 || skipSysex)
{ // This message will never fit. Throw it away. { // This message will never fit. Throw it away.
track->EventP += len; track->EventP += len;
} }

View file

@ -364,6 +364,7 @@ bool MIDIStreamer::InitPlayback()
} }
source->CheckCaps(MIDI->GetTechnology()); source->CheckCaps(MIDI->GetTechnology());
if (!MIDI->CanHandleSysex()) source->SkipSysex();
if (MIDI->Preprocess(this, m_Looping)) if (MIDI->Preprocess(this, m_Looping))
{ {