aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/alsa.cpp
diff options
context:
space:
mode:
authorJonathan Gray2003-06-01 03:25:14 +0000
committerJonathan Gray2003-06-01 03:25:14 +0000
commit220c2f6389bd97014fb7c9a0c243f12ed6ca009e (patch)
tree8365d7da6e053e893faa71864ddbaba4243c5766 /backends/midi/alsa.cpp
parent11e188c52084a05a915679f5129ae2f0dea66bcc (diff)
downloadscummvm-rg350-220c2f6389bd97014fb7c9a0c243f12ed6ca009e.tar.gz
scummvm-rg350-220c2f6389bd97014fb7c9a0c243f12ed6ca009e.tar.bz2
scummvm-rg350-220c2f6389bd97014fb7c9a0c243f12ed6ca009e.zip
give alsa sysex more chance of working, still broken though
svn-id: r8218
Diffstat (limited to 'backends/midi/alsa.cpp')
-rw-r--r--backends/midi/alsa.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp
index 8d76f00ca9..ae67a85a95 100644
--- a/backends/midi/alsa.cpp
+++ b/backends/midi/alsa.cpp
@@ -30,6 +30,7 @@
#include "stdafx.h"
#include "common/engine.h" // for warning/error/debug
#include <alsa/asoundlib.h>
+#include "common/util.h" // for hexdump
/*
* ALSA sequencer driver
@@ -187,7 +188,17 @@ void MidiDriver_ALSA::send(uint32 b) {
}
void MidiDriver_ALSA::sysEx(byte *msg, uint16 length) {
- snd_seq_ev_set_sysex(&ev, length, msg);
+ unsigned char buf[1024];
+
+ if (length > 254) {
+ warning("Cannot send SysEx block - data too large");
+ return;
+ }
+ buf[0] = 0xF0;
+ memcpy(&buf[1], msg, length);
+ buf[length + 1] = 0xF7;
+ // hexdump(buf, length + 2);
+ snd_seq_ev_set_sysex(&ev, length + 2, &buf);
}
int MidiDriver_ALSA::parse_addr(char *arg, int *client, int *port) {