mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- 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:
parent
f7ce4dd2da
commit
c5153ca095
7 changed files with 14 additions and 3 deletions
|
@ -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; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -25,6 +25,7 @@ class MIDISource
|
|||
protected:
|
||||
|
||||
bool isLooping = false;
|
||||
bool skipSysex = false;
|
||||
int Division = 0;
|
||||
int Tempo = 500000;
|
||||
int InitialTempo = 500000;
|
||||
|
@ -55,6 +56,8 @@ public:
|
|||
isLooping = looped;
|
||||
}
|
||||
|
||||
void SkipSysex() { skipSysex = true; }
|
||||
|
||||
bool isValid() const { return Division > 0; }
|
||||
int getDivision() const { return Division; }
|
||||
int getInitialTempo() const { return InitialTempo; }
|
||||
|
|
|
@ -644,7 +644,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;
|
||||
}
|
||||
|
|
|
@ -585,7 +585,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;
|
||||
}
|
||||
|
|
|
@ -515,7 +515,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;
|
||||
}
|
||||
|
|
|
@ -364,6 +364,7 @@ bool MIDIStreamer::InitPlayback()
|
|||
}
|
||||
|
||||
source->CheckCaps(MIDI->GetTechnology());
|
||||
if (!MIDI->CanHandleSysex()) source->SkipSysex();
|
||||
|
||||
if (MIDI->Preprocess(this, m_Looping))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue