aboutsummaryrefslogtreecommitdiff
path: root/scumm/imuse.cpp
diff options
context:
space:
mode:
authorJamieson Christian2003-09-30 08:25:57 +0000
committerJamieson Christian2003-09-30 08:25:57 +0000
commite70fcf1737812b3afa35f5350ba80e07d8359569 (patch)
treef138cae9868d9d282ecd142c2741a94217941407 /scumm/imuse.cpp
parentc118d14098cec7803c5756c60b9eca294e07f0ed (diff)
downloadscummvm-rg350-e70fcf1737812b3afa35f5350ba80e07d8359569.tar.gz
scummvm-rg350-e70fcf1737812b3afa35f5350ba80e07d8359569.tar.bz2
scummvm-rg350-e70fcf1737812b3afa35f5350ba80e07d8359569.zip
Fix for Bug [812740] ALL: MT32: some notes cut off early
logicdeluxe's patch to set MT-32 partial reserves equally for all channels, to ensure that entire notes don't get cut off. The patch as committed is slightly modified to reorder the MT-32 initialization sequence. The mods (1) ensure a brief delay between SysEx transmissions to give the MT-32 time to process each request, and (2) hopefully sequence the delays such that the ScummVM welcome message is actually readable and doesn't just flash for a split-second (as was the reported behavior in the past). svn-id: r10498
Diffstat (limited to 'scumm/imuse.cpp')
-rw-r--r--scumm/imuse.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 9509151f19..dc74f91413 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -44,6 +44,7 @@
IMuseInternal::IMuseInternal() :
_old_adlib_instruments(false),
_enable_multi_midi(false),
+_native_mt32(false),
_midi_adlib(0),
_midi_native(0),
_base_sounds(0),
@@ -1084,6 +1085,7 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
break;
case IMuse::PROP_NATIVE_MT32:
+ _native_mt32 = (value > 0);
Instrument::nativeMT32(value > 0);
break;
@@ -1163,8 +1165,8 @@ void IMuseInternal::initMidiDriver(MidiDriver *midi) {
if (result)
error("IMuse initialization - %s", MidiDriver::getErrorName(result));
- // In case we have an MT-32 attached.
- initMT32(midi);
+ if (_native_mt32)
+ initMT32(midi);
// Connect to the driver's timer
midi->setTimerCallback(midi, &IMuseInternal::midiTimerCallback);
@@ -1175,16 +1177,17 @@ void IMuseInternal::initMT32(MidiDriver *midi) {
char info[256] = "ScummVM ";
int len;
- // Compute version string(truncated to 20 chars max.)
+ // Reset the MT-32
+ memcpy(&buffer[4], "\x7f\x00\x00\x01\x00", 5);
+ midi->sysEx(buffer, 9);
+ g_system->delay_msecs (100);
+
+ // Compute version string (truncated to 20 chars max.)
strcat(info, gScummVMVersion);
len = strlen(info);
if (len > 20)
len = 20;
- // Reset the MT-32
- memcpy(&buffer[4], "\x7f\x00\x00\x01\x00", 5);
- midi->sysEx(buffer, 9);
-
// Display a welcome message on MT-32 displays.
memcpy(&buffer[4], "\x20\x00\x00", 3);
memcpy(&buffer[7], " ", 20);
@@ -1194,6 +1197,16 @@ void IMuseInternal::initMT32(MidiDriver *midi) {
checksum -= buffer[i];
buffer[27] = checksum;
midi->sysEx(buffer, 28);
+ g_system->delay_msecs (500);
+
+ // Set master volume to 100%
+ memcpy(&buffer[4], "\x10\x00\x16\x64\x76", 5);
+ midi->sysEx(buffer, 9);
+ g_system->delay_msecs (500);
+
+ // Set partial reserve equally for all channels
+ memcpy(&buffer[4], "\x10\x00\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x48", 13);
+ midi->sysEx(buffer, 17);
}
void IMuseInternal::init_queue() {