aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/coreaudio.cpp
diff options
context:
space:
mode:
authorMax Horn2007-02-16 13:30:41 +0000
committerMax Horn2007-02-16 13:30:41 +0000
commit4db72c8762de07e8de6bc693a8d2cc5ceef74330 (patch)
treef71f373c70f3061a4c372537e5bd980e93d6f9f4 /backends/midi/coreaudio.cpp
parent96162c14eab2654802e86ce096e14ee852f9829d (diff)
downloadscummvm-rg350-4db72c8762de07e8de6bc693a8d2cc5ceef74330.tar.gz
scummvm-rg350-4db72c8762de07e8de6bc693a8d2cc5ceef74330.tar.bz2
scummvm-rg350-4db72c8762de07e8de6bc693a8d2cc5ceef74330.zip
Unified how we deal with (and how we generate) MIDI sysex messages -- in particular, we now always do so w/o framing the message (documented this with a Doxygen comment in the MidiDriver class)
svn-id: r25630
Diffstat (limited to 'backends/midi/coreaudio.cpp')
-rw-r--r--backends/midi/coreaudio.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index c79454652d..e058e96f6f 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -178,22 +178,18 @@ void MidiDriver_CORE::send(uint32 b) {
}
void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) {
- assert(_auGraph != NULL);
+ unsigned char buf[256];
- // Add SysEx frame if missing
- byte *buf = 0;
- if (*msg != 0xF0) {
- buf = (byte *)malloc(length + 2);
- buf[0] = 0xF0;
- memcpy(buf+1, msg, length);
- buf[length+1] = 0xF7;
- msg = buf;
- length += 2;
- }
+ assert(length + 2 <= 256);
+ assert(_auGraph != NULL);
- MusicDeviceSysEx(_synth, msg, length);
+ // Add SysEx frame
+ buf[0] = 0xF0;
+ memcpy(buf + 1, msg, length);
+ buf[length + 1] = 0xF7;
- free(buf);
+ // Send it
+ MusicDeviceSysEx(_synth, buf, length+2);
}
MidiDriver *MidiDriver_CORE_create() {