diff options
author | Torbjörn Andersson | 2012-11-18 14:30:17 +0100 |
---|---|---|
committer | Torbjörn Andersson | 2012-11-18 14:30:17 +0100 |
commit | 4f18a92f5a91eb502518846771bc8e82ff7da20a (patch) | |
tree | d1fedadd0e83ce1e6bf766967af799121ca9a2c5 /engines/scumm/player_mac.h | |
parent | f3c9b218065357ef0178e4d68143deada86b6ed0 (diff) | |
download | scummvm-rg350-4f18a92f5a91eb502518846771bc8e82ff7da20a.tar.gz scummvm-rg350-4f18a92f5a91eb502518846771bc8e82ff7da20a.tar.bz2 scummvm-rg350-4f18a92f5a91eb502518846771bc8e82ff7da20a.zip |
SCUMM: Prevent music channels from drifting out of sync in Mac MI1
In looped music, prevent the music channels from drifting out of
sync over time. This was noticeable after a few minutes in the
SCUMM Bar. We do this by extending the last note (which is just
zeroes, so we didn't even use to play it) so that it has the
exact number of samples needed to make all channels the exact
same length. (This is calculated when the music is loaded, so it
does not need any extra data in the save games, thankfully.)
As a result, the getNextNote() is now responsible for converting
the duration to number of samples (out of necessity) and for
converting the note to a pitch modifier (out of symmetry). I made
several false starts before I realized how much easier it would
be this way.
Diffstat (limited to 'engines/scumm/player_mac.h')
-rw-r--r-- | engines/scumm/player_mac.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/scumm/player_mac.h b/engines/scumm/player_mac.h index 3f5184d2d8..c46495c333 100644 --- a/engines/scumm/player_mac.h +++ b/engines/scumm/player_mac.h @@ -99,7 +99,7 @@ private: virtual bool checkMusicAvailable() { return false; } virtual bool loadMusic(const byte *ptr) { return false; } - virtual bool getNextNote(int ch, uint16 &duration, byte &value, byte &velocity) { return false; } + virtual bool getNextNote(int ch, uint32 &samples, int &pitchModifier, byte &velocity) { return false; } protected: struct Channel { @@ -122,6 +122,9 @@ protected: ScummEngine *const _vm; Channel *_channel; + + uint32 durationToSamples(uint16 duration); + int noteToPitchModifier(byte note, Instrument *instrument); }; } // End of namespace Scumm |