GetMidiMessageSize crashes on system exclusive

When today I used my Yamaha S90 instead of CP4 to control Gig Performer,
I found out that system exclusive messages (like changing the tempo or EQ) consistently crashed Gig Performer.
On my Windows 10 system running Gig Performer V2.3, it is 100% reproducible using the script

var MIDI : MidiInBlock
On MidiEvent(m : MidiMessage) from MIDI
var n : integer
n = GetMidiMessageSize(m)
End

Without the GetMidiMessageSize, there is no crash.

Some examples of midi messages that cause crashes:

f0 43 10 6b 40 70 22 00 01 f7 (Yamaha tempo)
f0 43 10 6b 40 70 31 00 f7 (Yamaha EQ)

Louis, what happens when you change from integer to double?

var MIDI : MidiInBlock
On MidiEvent(m : MidiMessage) from MIDI
var n : double
n = GetMidiMessageSize(m)
End

Hello Louis,
Uunfortunately SysEx messages are not yet supported in GP Script. We’ll be addressing the crash and implementing support for it at some point, but right now the SysEx messages are not supported.

Thank you for your report

For me it is ok if only the crash is addressed.
It’s a bit tricky on stage to have to avoid touching certain sliders :slight_smile:

Thanks for the quick response!

Why are you using MidiMessage callbacks rather than note or cc message callbacks? (I have a feeling I know the answer…are you trying to detect some of the 1-byte midi messages?)

A (currently 1200-line) script enables me to configure my gig (only 1 gig with many vsts, no variations)
with one bank-select/program change message (yes, that’s the one :slight_smile: ).

I’m probably not an average gig performer user though… :slight_smile:

None of those are 1 byte messages but we don’t have a callback for program changes so that’s probably why you’re using the generic midimessage callback.

In the short term we will have to change the midimessage callback so that it ignores incoming sysex messages, that will prevent the crash

Ignoring sysex is indeed even a better solution.

Thanks again!

Ignoring sysex is indeed even better.

Thanks again!

OK - I misspoke (miswrote?) earlier. We do have a callback for program change messages so why can’t you use the control change callback to process the bank switch message and then the program change callback to handle, well, the program change?
In other words, why are you using the MidiMessage callback at all?

Hmmmm, I probably missed that this callback existed (I now indeed see it in the templates).
I’ll rewrite my script and let you know if I still encounter any issues, thanks!

Also, note that you can use constrained callbacks so, for example

var programChange, lsb, msb : integer

On ControlChangeEvent(m : ControlChangeMessage) Matching 32 from <MidiIn block name>
    lsb = GetCCValue(m)
End

On ControlChangeEvent(m : ControlChangeMessage) Matching 0 from <MidiIn block name>
    msb = GetCCValue(m)
End

On ProgramChangeEvent(m : ProgramChangeMessage) from <MidiIn block name>
    programChange = GetProgramChangeNumber(m)

    // Do something with programChange and whatever bank change values you've got
End


That way you don’t even need to test the control change number as those callbacks will ONLY be called for CC 32 or CC 0 respectively

Thanks, tried it and it works perfectly!