aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJohannes Schickel2008-11-30 04:42:30 +0000
committerJohannes Schickel2008-11-30 04:42:30 +0000
commit2ebe04ac3eda7bda56fc23c4958d3da84081429f (patch)
tree5f9e7e00873a9303deb754b39a42acef6dfddb5e /backends
parent17a699a43867dfb23c271a0f22a67176c0ce328c (diff)
downloadscummvm-rg350-2ebe04ac3eda7bda56fc23c4958d3da84081429f.tar.gz
scummvm-rg350-2ebe04ac3eda7bda56fc23c4958d3da84081429f.tar.bz2
scummvm-rg350-2ebe04ac3eda7bda56fc23c4958d3da84081429f.zip
- Extended MidiDriver::sysEx to allow 264 byte sysEx messages
- Updated all drivers to allow 264+2 byte sysEx messages - Implemented sysEx processing for MT-32 for Kyra1 and HoF. MT-32 should now be working properly. svn-id: r35180
Diffstat (limited to 'backends')
-rw-r--r--backends/midi/alsa.cpp4
-rw-r--r--backends/midi/camd.cpp4
-rw-r--r--backends/midi/coreaudio.cpp4
-rw-r--r--backends/midi/seq.cpp4
-rw-r--r--backends/midi/stmidi.cpp5
-rw-r--r--backends/midi/timidity.cpp4
-rw-r--r--backends/midi/windows.cpp4
-rw-r--r--backends/midi/zodiac.cpp2
8 files changed, 17 insertions, 14 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp
index b78066cdd4..8a5c856983 100644
--- a/backends/midi/alsa.cpp
+++ b/backends/midi/alsa.cpp
@@ -213,9 +213,9 @@ void MidiDriver_ALSA::send(uint32 b) {
}
void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) {
- unsigned char buf[256];
+ unsigned char buf[266];
- assert(length + 2 <= 256);
+ assert(length + 2 <= ARRAYSIZE(buf));
// Add SysEx frame
buf[0] = 0xF0;
diff --git a/backends/midi/camd.cpp b/backends/midi/camd.cpp
index bab047746b..24d211281c 100644
--- a/backends/midi/camd.cpp
+++ b/backends/midi/camd.cpp
@@ -115,9 +115,9 @@ void MidiDriver_CAMD::send(uint32 b) {
}
void MidiDriver_CAMD::sysEx(const byte *msg, uint16 length) {
- unsigned char buf[256];
+ unsigned char buf[266];
- assert(length + 2 <= 256);
+ assert(length + 2 <= ARRAYSIZE(buf));
// Add SysEx frame
buf[0] = 0xF0;
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 0d72a1576a..d89123292c 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -190,9 +190,9 @@ void MidiDriver_CORE::send(uint32 b) {
}
void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) {
- unsigned char buf[256];
+ unsigned char buf[266];
- assert(length + 2 <= 256);
+ assert(length + 2 <= ARRAYSIZE(buf));
assert(_auGraph != NULL);
// Add SysEx frame
diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp
index 920356147f..9c7cc83d67 100644
--- a/backends/midi/seq.cpp
+++ b/backends/midi/seq.cpp
@@ -146,11 +146,11 @@ void MidiDriver_SEQ::send(uint32 b) {
}
void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) {
- unsigned char buf [1024];
+ unsigned char buf [1330];
int position = 0;
const byte *chr = msg;
- assert(length + 2 <= 256);
+ assert(length + 2 <= 266);
buf[position++] = SEQ_MIDIPUTC;
buf[position++] = 0xF0;
diff --git a/backends/midi/stmidi.cpp b/backends/midi/stmidi.cpp
index 6cba1b819d..f07b5b56ca 100644
--- a/backends/midi/stmidi.cpp
+++ b/backends/midi/stmidi.cpp
@@ -91,7 +91,10 @@ void MidiDriver_STMIDI::send(uint32 b) {
}
void MidiDriver_STMIDI::sysEx (const byte *msg, uint16 length) {
- if (length > 254) {
+ // FIXME: LordHoto doesn't know if this will still work
+ // when sending 264 byte sysEx data, as needed by KYRA,
+ // feel free to revert it to 254 again if needed.
+ if (length > 264) {
warning ("Cannot send SysEx block - data too large");
return;
}
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
index d13fc4b79a..47ef0f2ea9 100644
--- a/backends/midi/timidity.cpp
+++ b/backends/midi/timidity.cpp
@@ -487,11 +487,11 @@ void MidiDriver_TIMIDITY::send(uint32 b) {
void MidiDriver_TIMIDITY::sysEx(const byte *msg, uint16 length) {
fprintf(stderr, "Timidity::sysEx\n");
- unsigned char buf[1024];
+ unsigned char buf[1330];
int position = 0;
const byte *chr = msg;
- assert(length + 2 <= 256);
+ assert(length + 2 <= 266);
buf[position++] = SEQ_MIDIPUTC;
buf[position++] = 0xF0;
diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp
index d1f79f4fa3..f9da3e3e4d 100644
--- a/backends/midi/windows.cpp
+++ b/backends/midi/windows.cpp
@@ -42,7 +42,7 @@
class MidiDriver_WIN : public MidiDriver_MPU401 {
private:
MIDIHDR _streamHeader;
- byte _streamBuffer[256]; // SysEx blocks should be no larger than 256 bytes
+ byte _streamBuffer[266]; // SysEx blocks should be no larger than 266 bytes
HANDLE _streamEvent;
HMIDIOUT _mo;
bool _isOpen;
@@ -106,7 +106,7 @@ void MidiDriver_WIN::sysEx(const byte *msg, uint16 length) {
return;
}
- assert(length+2 <= 256);
+ assert(length+2 <= 266);
midiOutUnprepareHeader(_mo, &_streamHeader, sizeof(_streamHeader));
diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp
index f17f6796b7..1b3b578aab 100644
--- a/backends/midi/zodiac.cpp
+++ b/backends/midi/zodiac.cpp
@@ -112,7 +112,7 @@ void MidiDriver_Zodiac::send(uint32 b) {
}
void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) {
- unsigned char buf[256];
+ unsigned char buf[266];
buf[0] = 0xF0;
memcpy(buf + 1, msg, length);