aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-17 02:42:31 +0000
committerJohannes Schickel2010-01-17 02:42:31 +0000
commite11e9338d151e659bbd8d23922375b550e362dd3 (patch)
tree8b912b06817e89fb1a9c00cef0a6c3eacb0259f8 /engines/kyra
parentc7b258f87e504872e3b4a2dc2b619f6ffc626626 (diff)
downloadscummvm-rg350-e11e9338d151e659bbd8d23922375b550e362dd3.tar.gz
scummvm-rg350-e11e9338d151e659bbd8d23922375b550e362dd3.tar.bz2
scummvm-rg350-e11e9338d151e659bbd8d23922375b550e362dd3.zip
Delay the time a sysEx takes to send instead of the old (incorrect) way of delaying only 45ms between two sysEx calls. (Code thankfully borrowed from waltervn).
svn-id: r47336
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/sound_midi.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp
index 9a6a2f0110..e6b20c82f4 100644
--- a/engines/kyra/sound_midi.cpp
+++ b/engines/kyra/sound_midi.cpp
@@ -66,7 +66,6 @@ private:
OSystem *_system;
MidiDriver *_output;
- uint32 _lastSysEx;
bool _isMT32;
bool _defaultMT32;
@@ -113,7 +112,7 @@ private:
} _sources[4];
};
-MidiOutput::MidiOutput(OSystem *system, MidiDriver *output, bool isMT32, bool defaultMT32) : _system(system), _output(output), _lastSysEx(0) {
+MidiOutput::MidiOutput(OSystem *system, MidiDriver *output, bool isMT32, bool defaultMT32) : _system(system), _output(output) {
_isMT32 = isMT32;
_defaultMT32 = defaultMT32;
@@ -269,14 +268,15 @@ void MidiOutput::sendIntern(const byte event, const byte channel, byte param1, c
}
void MidiOutput::sysEx(const byte *msg, uint16 length) {
- uint32 curTime = _system->getMillis();
+ // Wait the time it takes to send the SysEx data
+ uint32 delay = (length + 2) * 1000 / 3125;
- if (_lastSysEx + 45 > curTime)
- _system->delayMillis(_lastSysEx + 45 - curTime);
+ // Plus an additional delay for the MT-32 rev00
+ if (_isMT32)
+ delay += 40;
_output->sysEx(msg, length);
-
- _lastSysEx = _system->getMillis();
+ _system->delayMillis(delay);
}
void MidiOutput::sendSysEx(const byte p1, const byte p2, const byte p3, const byte *buffer, const int size) {