[Scummvm-cvs-logs] SF.net SVN: scummvm:[47336] scummvm/trunk/engines/kyra/sound_midi.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Jan 17 03:42:32 CET 2010
Revision: 47336
http://scummvm.svn.sourceforge.net/scummvm/?rev=47336&view=rev
Author: lordhoto
Date: 2010-01-17 02:42:31 +0000 (Sun, 17 Jan 2010)
Log Message:
-----------
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).
Modified Paths:
--------------
scummvm/trunk/engines/kyra/sound_midi.cpp
Modified: scummvm/trunk/engines/kyra/sound_midi.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_midi.cpp 2010-01-17 02:13:40 UTC (rev 47335)
+++ scummvm/trunk/engines/kyra/sound_midi.cpp 2010-01-17 02:42:31 UTC (rev 47336)
@@ -66,7 +66,6 @@
OSystem *_system;
MidiDriver *_output;
- uint32 _lastSysEx;
bool _isMT32;
bool _defaultMT32;
@@ -113,7 +112,7 @@
} _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::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) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list