diff options
author | Colin Snover | 2017-06-16 16:32:16 -0500 |
---|---|---|
committer | Colin Snover | 2017-06-18 21:42:58 -0500 |
commit | d556dcc57bf50a03d81ab7a1ef59a9e5758465bf (patch) | |
tree | 977a4935fdff18a022860871475a40af25c01e95 /engines/sci/sound/midiparser_sci.cpp | |
parent | 733eaeb499bb39f75e7dd218df4c71b06b7e1610 (diff) | |
download | scummvm-rg350-d556dcc57bf50a03d81ab7a1ef59a9e5758465bf.tar.gz scummvm-rg350-d556dcc57bf50a03d81ab7a1ef59a9e5758465bf.tar.bz2 scummvm-rg350-d556dcc57bf50a03d81ab7a1ef59a9e5758465bf.zip |
SCI: Switch SCI2 games to use Audio32
Upon investigation of Sound code across SCI32 games, it was
determined that there are actually (at least) 3 different
revisions, not just a single SCI2.1 version. This patch only
changes the parts of Sound code that are relevant to the correct
use of Audio32.
Fixes Trac#9736, Trac#9756, Trac#9767, Trac#9791.
Diffstat (limited to 'engines/sci/sound/midiparser_sci.cpp')
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index a25ce2887b..bdd0d1b36e 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -752,18 +752,12 @@ bool MidiParser_SCI::processEvent(const EventInfo &info, bool fireEvents) { case kUpdateCue: if (!_jumpingToTick) { int inc; - switch (_soundVersion) { - case SCI_VERSION_0_EARLY: - case SCI_VERSION_0_LATE: + if (_soundVersion <= SCI_VERSION_0_LATE) { inc = info.basic.param2; - break; - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: - case SCI_VERSION_2_1_EARLY: + } else if (_soundVersion >= SCI_VERSION_1_EARLY && _soundVersion <= SCI_VERSION_2_1_MIDDLE) { inc = 1; - break; - default: - error("unsupported _soundVersion"); + } else { + error("Unsupported _soundVersion %s", getSciVersionDesc(_soundVersion)); } _pSnd->dataInc += inc; debugC(4, kDebugLevelSound, "datainc %04x", inc); @@ -895,22 +889,14 @@ void MidiParser_SCI::allNotesOff() { void MidiParser_SCI::setMasterVolume(byte masterVolume) { assert(masterVolume <= MUSIC_MASTERVOLUME_MAX); _masterVolume = masterVolume; - switch (_soundVersion) { - case SCI_VERSION_0_EARLY: - case SCI_VERSION_0_LATE: + if (_soundVersion <= SCI_VERSION_0_LATE) { // update driver master volume setVolume(_volume); - break; - - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: - case SCI_VERSION_2_1_EARLY: + } else if (_soundVersion >= SCI_VERSION_1_EARLY && _soundVersion <= SCI_VERSION_2_1_MIDDLE) { // directly set master volume (global volume is merged with channel volumes) ((MidiPlayer *)_driver)->setVolume(masterVolume); - break; - - default: - error("MidiParser_SCI::setVolume: Unsupported soundVersion"); + } else { + error("MidiParser_SCI::setVolume: Unsupported soundVersion %s", getSciVersionDesc(_soundVersion)); } } @@ -918,26 +904,17 @@ void MidiParser_SCI::setVolume(byte volume) { assert(volume <= MUSIC_VOLUME_MAX); _volume = volume; - switch (_soundVersion) { - case SCI_VERSION_0_EARLY: - case SCI_VERSION_0_LATE: { + if (_soundVersion <= SCI_VERSION_0_LATE) { // SCI0 adlib driver doesn't support channel volumes, so we need to go this way int16 globalVolume = _volume * _masterVolume / MUSIC_VOLUME_MAX; ((MidiPlayer *)_driver)->setVolume(globalVolume); - break; - } - - case SCI_VERSION_1_EARLY: - case SCI_VERSION_1_LATE: - case SCI_VERSION_2_1_EARLY: + } else if (_soundVersion >= SCI_VERSION_1_EARLY && _soundVersion <= SCI_VERSION_2_1_MIDDLE) { // Send previous channel volumes again to actually update the volume for (int i = 0; i < 15; i++) if (_channelRemap[i] != -1) sendToDriver(0xB0 + i, 7, _channelVolume[i]); - break; - - default: - error("MidiParser_SCI::setVolume: Unsupported soundVersion"); + } else { + error("MidiParser_SCI::setVolume: Unsupported soundVersion %s", getSciVersionDesc(_soundVersion)); } } |