diff options
author | Torbjörn Andersson | 2005-10-12 06:57:25 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-10-12 06:57:25 +0000 |
commit | 744a01b4490552b30778fa1a2b8be47588a3bd8a (patch) | |
tree | 0eb11f515c7f3323fc41a3473c2d4f4d57b20ea4 | |
parent | cd2c0f2e4781e99d1521c442b674624eb9efe6e2 (diff) | |
download | scummvm-rg350-744a01b4490552b30778fa1a2b8be47588a3bd8a.tar.gz scummvm-rg350-744a01b4490552b30778fa1a2b8be47588a3bd8a.tar.bz2 scummvm-rg350-744a01b4490552b30778fa1a2b8be47588a3bd8a.zip |
Looks like my pitch wheel change still has the ability to break things. See
bug #1324103.
I've changed it - again - so that now it only centers the pitch wheels on
unload if a new mpCenterPitchWheelOnUnload property has been set. Currently
only the SAGA engine does that, so if it still breaks it only breaks SAGA.
I've also fixed what looked like an unintentional fall-through in the
MidiParser::property() function. Surently that can't cause any new
regressions? Please.
svn-id: r19032
-rw-r--r-- | saga/music.cpp | 1 | ||||
-rw-r--r-- | sound/midiparser.cpp | 20 | ||||
-rw-r--r-- | sound/midiparser.h | 4 |
3 files changed, 19 insertions, 6 deletions
diff --git a/saga/music.cpp b/saga/music.cpp index a4a11b4e31..9e0dad6152 100644 --- a/saga/music.cpp +++ b/saga/music.cpp @@ -487,6 +487,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { parser->setTrack(0); parser->setMidiDriver(_player); parser->setTimerRate(_player->getBaseTempo()); + parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1); _player->_parser = parser; _player->setVolume(_vm->_musicVolume == 10 ? 255 : _vm->_musicVolume * 25); diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp index 1a1b210abb..789249e742 100644 --- a/sound/midiparser.cpp +++ b/sound/midiparser.cpp @@ -39,6 +39,7 @@ _tempo(500000), _psec_per_tick(5208), // 500000 / 96 _autoLoop(false), _smartJump(false), +_centerPitchWheelOnUnload(false), _num_tracks(0), _active_track(255), _abort_parse(0) { @@ -49,8 +50,13 @@ void MidiParser::property(int prop, int value) { switch (prop) { case mpAutoLoop: _autoLoop = (value != 0); + break; case mpSmartJump: _smartJump = (value != 0); + break; + case mpCenterPitchWheelOnUnload: + _centerPitchWheelOnUnload = (value != 0); + break; } } @@ -396,12 +402,16 @@ void MidiParser::unloadMusic() { _active_track = 255; _abort_parse = true; - // Center the pitch wheels in preparation for the next piece of music. - // It's not safe to do this from within allNotesOff(). + if (_centerPitchWheelOnUnload) { + // Center the pitch wheels in preparation for the next piece of + // music. It's not safe to do this from within allNotesOff(), + // and might not even be safe here, so we only do it if the + // client has explicitly asked for it. - if (_driver) { - for (int i = 0; i < 16; ++i) { - _driver->send(0x4000E0 | i); // Center the pitch wheel + if (_driver) { + for (int i = 0; i < 16; ++i) { + _driver->send(0x4000E0 | i); + } } } } diff --git a/sound/midiparser.h b/sound/midiparser.h index d939de3131..37c1d8e753 100644 --- a/sound/midiparser.h +++ b/sound/midiparser.h @@ -276,6 +276,7 @@ protected: uint32 _psec_per_tick; //!< Microseconds per tick (_tempo / _ppqn). 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 // FIXME: ? Was 32 here, Kyra tracks use 120(!!!) which seems wrong. this is a hacky // workaround until situation is investigated. @@ -341,7 +342,8 @@ public: enum { mpMalformedPitchBends = 1, mpAutoLoop = 2, - mpSmartJump = 3 + mpSmartJump = 3, + mpCenterPitchWheelOnUnload = 4 }; public: |