- 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 committed by drfrag666
parent 9410e5ea98
commit da5fccb598
7 changed files with 14 additions and 3 deletions

View file

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

View file

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

View file

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

View file

@ -648,7 +648,7 @@ uint32_t *HMISong::SendCommand (uint32_t *events, TrackInfo *track, uint32_t del
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{
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.
track->TrackP += len;
}

View file

@ -589,7 +589,7 @@ uint32_t *MIDISong2::SendCommand (uint32_t *events, TrackInfo *track, uint32_t d
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{
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.
track->TrackP += len;
}

View file

@ -519,7 +519,7 @@ uint32_t *XMISong::SendCommand (uint32_t *events, EventSource due, uint32_t dela
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{
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.
track->EventP += len;
}

View file

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