From d556dcc57bf50a03d81ab7a1ef59a9e5758465bf Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 16 Jun 2017 16:32:16 -0500 Subject: 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. --- engines/sci/sound/midiparser_sci.cpp | 47 +++++++++--------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) (limited to 'engines/sci/sound/midiparser_sci.cpp') 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)); } } -- cgit v1.2.3