aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorJamieson Christian2003-05-24 04:39:47 +0000
committerJamieson Christian2003-05-24 04:39:47 +0000
commitbc5511c51447f5d1122adc0016aa8d8bced73ea6 (patch)
tree10d4e42eed065311cb2aa027aed1f43b76462e91 /simon
parent807f3e1e865162b43a991967c2aca0b14c7fd8a5 (diff)
downloadscummvm-rg350-bc5511c51447f5d1122adc0016aa8d8bced73ea6.tar.gz
scummvm-rg350-bc5511c51447f5d1122adc0016aa8d8bced73ea6.tar.bz2
scummvm-rg350-bc5511c51447f5d1122adc0016aa8d8bced73ea6.zip
Fixed hanging notes when switching tracks
svn-id: r7878
Diffstat (limited to 'simon')
-rw-r--r--simon/midi.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/simon/midi.cpp b/simon/midi.cpp
index 32e4119130..b1129e15b8 100644
--- a/simon/midi.cpp
+++ b/simon/midi.cpp
@@ -90,7 +90,7 @@ void MidiPlayer::send (uint32 b) {
b = (b & 0xFF00FFFF) | (volume << 16);
} else if ((b & 0xFFF0) == 0x007BB0) {
// Only respond to an All Notes Off if this channel
- // has already been marked "in use" by this parser.
+ // has already been allocated.
if (!_current->channel [b & 0x0F])
return;
}
@@ -99,7 +99,7 @@ void MidiPlayer::send (uint32 b) {
if (!_current->channel [channel])
_current->channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
if (_current->channel [channel])
- _driver->send ((b & ~0x0F) | _current->channel[channel]->getNumber());
+ _driver->send ((b & 0xFFFFFFF0) | _current->channel[channel]->getNumber());
}
void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
@@ -156,7 +156,9 @@ void MidiPlayer::startTrack (int track) {
_system->lock_mutex (_mutex);
if (_music.parser) {
+ _current = &_music;
delete _music.parser;
+ _current = 0;
_music.parser = 0;
}
@@ -179,7 +181,9 @@ void MidiPlayer::startTrack (int track) {
return;
}
_currentTrack = (byte) track;
+ _current = &_music;
_music.parser->jumpToTick (0);
+ _current = 0;
}
_system->unlock_mutex (_mutex);
@@ -187,8 +191,11 @@ void MidiPlayer::startTrack (int track) {
void MidiPlayer::stop() {
_system->lock_mutex (_mutex);
- if (_music.parser)
+ if (_music.parser) {
+ _current = &_music;
_music.parser->jumpToTick(0);
+ }
+ _current = 0;
_currentTrack = 255;
_system->unlock_mutex (_mutex);
}