From ae823b5c6a31a568072545503dbc5c125d19c391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Andersson?= Date: Sun, 18 Nov 2012 17:49:23 +0100 Subject: [PATCH] SCUMM: Fix regression that caused "pops" in MI1 jungle music Properly treat rests as rests, not notes. Otherwise, it would try to play a really low note which just came out as a "pop". --- engines/scumm/player_v3m.cpp | 9 +++++++-- engines/scumm/player_v5m.cpp | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/engines/scumm/player_v3m.cpp b/engines/scumm/player_v3m.cpp index db532a9f6e0d..ad812a53ca7a 100644 --- a/engines/scumm/player_v3m.cpp +++ b/engines/scumm/player_v3m.cpp @@ -168,8 +168,13 @@ bool Player_V3M::getNextNote(int ch, uint32 &samples, int &pitchModifier, byte & uint16 duration = READ_BE_UINT16(&_channel[ch]._data[_channel[ch]._pos]); byte note = _channel[ch]._data[_channel[ch]._pos + 2]; samples = durationToSamples(duration); - pitchModifier = noteToPitchModifier(note, &_channel[ch]._instrument); - velocity = 127; + if (note > 0) { + pitchModifier = noteToPitchModifier(note, &_channel[ch]._instrument); + velocity = 127; + } else { + pitchModifier = 0; + velocity = 0; + } _channel[ch]._pos += 3; return true; } diff --git a/engines/scumm/player_v5m.cpp b/engines/scumm/player_v5m.cpp index d59cf9ade2ae..26cfb0e7c1fd 100644 --- a/engines/scumm/player_v5m.cpp +++ b/engines/scumm/player_v5m.cpp @@ -186,8 +186,15 @@ bool Player_V5M::getNextNote(int ch, uint32 &samples, int &pitchModifier, byte & uint16 duration = READ_BE_UINT16(&_channel[ch]._data[_channel[ch]._pos]); byte note = _channel[ch]._data[_channel[ch]._pos + 2]; samples = durationToSamples(duration); - pitchModifier = noteToPitchModifier(note, &_channel[ch]._instrument); - velocity = _channel[ch]._data[_channel[ch]._pos + 3]; + + if (note > 1) { + pitchModifier = noteToPitchModifier(note, &_channel[ch]._instrument); + velocity = _channel[ch]._data[_channel[ch]._pos + 3]; + } else { + pitchModifier = 0; + velocity = 0; + } + _channel[ch]._pos += 4; if (_channel[ch]._pos >= _channel[ch]._length) {