aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/seq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/midi/seq.cpp')
-rw-r--r--backends/midi/seq.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp
index b77ee579f2..0e6982e3ae 100644
--- a/backends/midi/seq.cpp
+++ b/backends/midi/seq.cpp
@@ -141,8 +141,8 @@ void MidiDriver_SEQ::sysEx (byte *msg, uint16 length) {
unsigned char buf [1024];
int position = 0;
byte *chr = msg;
-
- // Should be we using EV_SYSEX instead of SEQ_MIDIPUTC?
+/*
+ // Should we be using EV_SYSEX instead of SEQ_MIDIPUTC?
// I'm not sure how to send EV_SYSEX.
buf[position++] = SEQ_MIDIPUTC;
buf[position++] = 0xFF;
@@ -158,6 +158,25 @@ void MidiDriver_SEQ::sysEx (byte *msg, uint16 length) {
buf[position++] = 0xF7;
buf[position++] = _device_num;
buf[position++] = 0;
+*/
+ buf[position++] = EV_SYSEX;
+ buf[position++] = _device_num;
+ buf[position++] = 0xF0;
+ for (; length; --length, ++chr) {
+ if (position % 8 == 0) {
+ buf[position++] = EV_SYSEX;
+ buf[position++] = _device_num;
+ }
+ buf[position++] = *chr & 0x7F;
+ }
+ if (position % 8 == 0) {
+ buf[position++] = EV_SYSEX;
+ buf[position++] = _device_num;
+ }
+ buf[position++] = 0xF7;
+ while (position % 8 != 0)
+ buf[position++] = 0;
+
write (device, buf, position);
}