diff options
author | Filippos Karapetis | 2011-02-02 23:27:59 +0000 |
---|---|---|
committer | Filippos Karapetis | 2011-02-02 23:27:59 +0000 |
commit | 9b8c04045bad8422ce8da7d6a7b30c03f1ceb2a5 (patch) | |
tree | ced52fa37ee628ad13f9d60ba882b550ea02b21b /sound | |
parent | 149082c9e98e80140d2c8143b918ddfca20cdf7e (diff) | |
download | scummvm-rg350-9b8c04045bad8422ce8da7d6a7b30c03f1ceb2a5.tar.gz scummvm-rg350-9b8c04045bad8422ce8da7d6a7b30c03f1ceb2a5.tar.bz2 scummvm-rg350-9b8c04045bad8422ce8da7d6a7b30c03f1ceb2a5.zip |
MIDI: Fix for bug #3170988 - "MONKEY2: Messed up MT-32 music"
This is a regression from r55256. Apparently, SCUMM has issues when sending a sustain
off on a notes off event. Thus, this has been turned into a feature, which is disabled
by default. Since MADE, SAGA and tinsel all share the same music code and play regular
MIDI files, and this feature fixes hanging notes for them, it has been enabled for them.
Also, applied a patch for a bug regarding the notes off event in MADE and tinsel,
which has been applied in SAGA already
svn-id: r55746
Diffstat (limited to 'sound')
-rw-r--r-- | sound/midiparser.cpp | 7 | ||||
-rw-r--r-- | sound/midiparser.h | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp index 851f91e9b5..bd51a96d46 100644 --- a/sound/midiparser.cpp +++ b/sound/midiparser.cpp @@ -43,6 +43,7 @@ _psec_per_tick(5208), // 500000 / 96 _autoLoop(false), _smartJump(false), _centerPitchWheelOnUnload(false), +_sendSustainOffOnNotesOff(false), _num_tracks(0), _active_track(255), _abort_parse(0) { @@ -64,6 +65,9 @@ void MidiParser::property(int prop, int value) { case mpCenterPitchWheelOnUnload: _centerPitchWheelOnUnload = (value != 0); break; + case mpSendSustainOffOnNotesOff: + _sendSustainOffOnNotesOff = (value != 0); + break; } } @@ -281,7 +285,8 @@ void MidiParser::allNotesOff() { for (i = 0; i < 16; ++i) { sendToDriver(0xB0 | i, 0x7b, 0); // All notes off - sendToDriver(0xB0 | i, 0x40, 0); // Also send a sustain off event (bug #3116608) + if (_sendSustainOffOnNotesOff) + sendToDriver(0xB0 | i, 0x40, 0); // Also send a sustain off event (bug #3116608) } memset(_active_notes, 0, sizeof(_active_notes)); diff --git a/sound/midiparser.h b/sound/midiparser.h index 9ebcae7a07..0b18a19a5b 100644 --- a/sound/midiparser.h +++ b/sound/midiparser.h @@ -281,7 +281,7 @@ protected: bool _autoLoop; ///< For lightweight clients that don't provide their own flow control. bool _smartJump; ///< Support smart expiration of hanging notes when jumping bool _centerPitchWheelOnUnload; ///< Center the pitch wheels when unloading a song - + bool _sendSustainOffOnNotesOff; ///< Send a sustain off on a notes off event, stopping hanging notes byte *_tracks[120]; ///< Multi-track MIDI formats are supported, up to 120 tracks. byte _num_tracks; ///< Count of total tracks for multi-track MIDI formats. 1 for single-track formats. byte _active_track; ///< Keeps track of the currently active track, in multi-track formats. @@ -361,7 +361,13 @@ public: * Center the pitch wheels when unloading music in preparation * for the next piece of music. */ - mpCenterPitchWheelOnUnload = 4 + mpCenterPitchWheelOnUnload = 4, + + /** + * Sends a sustain off event when a notes off event is triggered. + * Stops hanging notes. + */ + mpSendSustainOffOnNotesOff = 5 }; public: |