[Scummvm-git-logs] scummvm master -> 70e62a757b6c760b2e9e8352076db377c34fa4eb
athrxx
athrxx at scummvm.org
Sat Jan 25 17:25:43 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
70e62a757b KYRA: (HOF) - fix bug #6314 (Wrong MIDI notes
Commit: 70e62a757b6c760b2e9e8352076db377c34fa4eb
https://github.com/scummvm/scummvm/commit/70e62a757b6c760b2e9e8352076db377c34fa4eb
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-25T18:24:58+01:00
Commit Message:
KYRA: (HOF) - fix bug #6314 (Wrong MIDI notes
sometimes heard at beginning of new s)
This is an attempt to fix that bug. It works for me, but it should see more testing.
I have tested the Windows "Microsoft GS Wavetable Synth" and our builtin MT-32 emulation. Both work fine with it. I presume the same will be true for all relevant hardware devices.
I haven't fully analyzed how the original driver silences the device (and I won't if I don't have to). My impression is that it does not send CC 0x78 (like I do). It seems to send only the CCs we have implemented (0x40, 0x60, 0x7B...). Maybe this whole bug is simply a race condition issue that the original didn't have...
Changed paths:
engines/kyra/sound/drivers/midi.cpp
engines/kyra/sound/drivers/midi.h
engines/kyra/sound/sound_midi.cpp
diff --git a/engines/kyra/sound/drivers/midi.cpp b/engines/kyra/sound/drivers/midi.cpp
index 5e8460a..2ca1844 100644
--- a/engines/kyra/sound/drivers/midi.cpp
+++ b/engines/kyra/sound/drivers/midi.cpp
@@ -352,4 +352,11 @@ void MidiOutput::stopNotesOnChannel(int channel) {
}
}
+void MidiOutput::allSoundsOff() {
+ for (int i = 0; i < 16; ++i) {
+ stopNotesOnChannel(i);
+ sendIntern(0xB0, i, 0x78, 0);
+ }
+}
+
} // End of namespace Kyra
diff --git a/engines/kyra/sound/drivers/midi.h b/engines/kyra/sound/drivers/midi.h
index 9e56c73..565c9e8 100644
--- a/engines/kyra/sound/drivers/midi.h
+++ b/engines/kyra/sound/drivers/midi.h
@@ -37,6 +37,7 @@ public:
void initSource(int source);
void deinitSource(int source);
void stopNotesOnChannel(int channel);
+ void allSoundsOff();
void setSoundSource(int source) { _curSource = source; }
diff --git a/engines/kyra/sound/sound_midi.cpp b/engines/kyra/sound/sound_midi.cpp
index 2390b75..b1a681d 100644
--- a/engines/kyra/sound/sound_midi.cpp
+++ b/engines/kyra/sound/sound_midi.cpp
@@ -281,9 +281,14 @@ void SoundMidiPC::playTrack(uint8 track) {
haltTrack();
- Common::StackLock lock(_mutex);
+ // The following two lines are meant as a fix for bug #6314.
+ // It is on purpose that they are outside the mutex lock.
+ _output->allSoundsOff();
+ _vm->delay(250);
+ Common::StackLock lock(_mutex);
_fadeMusicOut = false;
+
_output->setSourceVolume(0, _musicVolume, true);
_output->initSource(0);
More information about the Scummvm-git-logs
mailing list