From 7f44bc6d0e3d953e5be31a459643a570538cc761 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 11 Jan 2016 18:59:56 -0600 Subject: [PATCH] Add Yamaha and GM reset sysex handling to WildMidi --- src/wildmidi/wildmidi_lib.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/wildmidi/wildmidi_lib.cpp b/src/wildmidi/wildmidi_lib.cpp index 20857da12..d29a939fd 100644 --- a/src/wildmidi/wildmidi_lib.cpp +++ b/src/wildmidi/wildmidi_lib.cpp @@ -1976,7 +1976,7 @@ static void do_sysex_roland_drum_track(struct _mdi *mdi, } } -static void do_sysex_roland_reset(struct _mdi *mdi, struct _event_data *data) { +static void do_sysex_gm_reset(struct _mdi *mdi, struct _event_data *data) { int i; for (i = 0; i < 16; i++) { mdi->channel[i].bank = 0; @@ -2003,6 +2003,14 @@ static void do_sysex_roland_reset(struct _mdi *mdi, struct _event_data *data) { UNUSED(data); /* NOOP, to please the compiler gods */ } +static void do_sysex_roland_reset(struct _mdi *mdi, struct _event_data *data) { + do_sysex_gm_reset(mdi, data); +} + +static void do_sysex_yamaha_reset(struct _mdi *mdi, struct _event_data *data) { + do_sysex_gm_reset(mdi, data); +} + static int add_handle(void * handle) { struct _hndl *tmp_handle = NULL; @@ -2967,6 +2975,20 @@ void WildMidi_Renderer::LongEvent(const unsigned char *data, int len) } } } + // For non-Roland Sysex messages */ + else + { + const unsigned char gm_reset[] = { 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7 }; + const unsigned char yamaha_reset[] = { 0xf0, 0x43, 0x10, 0x4c, 0x00, 0x00, 0x7e, 0x00, 0xf7}; + if (len == 6 && memcmp(gm_reset, data, 6) == 0) + { + do_sysex_gm_reset((_mdi *)handle, NULL); + } + else if (len == 9 && memcmp(yamaha_reset, data, 9) == 0) + { + do_sysex_yamaha_reset((_mdi *)handle, NULL); + } + } } void WildMidi_Renderer::ComputeOutput(float *fbuffer, int len)