diff options
author | Martin Kiewitz | 2010-01-04 15:17:46 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-04 15:17:46 +0000 |
commit | f245917d6f08be640574df2ce128ef7bd248b0b6 (patch) | |
tree | 07f8c44914ed59fb1b575dd4033d0bfc3a8f31f9 /engines/sci | |
parent | d437b25c5774261f727a2e91f8e1b6a200ca5d4a (diff) | |
download | scummvm-rg350-f245917d6f08be640574df2ce128ef7bd248b0b6.tar.gz scummvm-rg350-f245917d6f08be640574df2ce128ef7bd248b0b6.tar.bz2 scummvm-rg350-f245917d6f08be640574df2ce128ef7bd248b0b6.zip |
SCI/newmusic: fadeout in sci0 (not stopping music yet), revert of SoundResource changes
svn-id: r46972
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/resource.cpp | 15 | ||||
-rw-r--r-- | engines/sci/sfx/midiparser.cpp | 28 | ||||
-rw-r--r-- | engines/sci/sfx/midiparser.h | 2 | ||||
-rw-r--r-- | engines/sci/sfx/music.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 9 |
5 files changed, 36 insertions, 20 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 3c99c9801d..1ecbff6eee 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1894,7 +1894,7 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi _tracks = new Track[_trackCount]; _tracks->digitalChannelNr = -1; _tracks->type = TRACKTYPE_NONE; - _tracks->channelCount = 16; + _tracks->channelCount = 1; // Digital sample data included? -> Add an additional channel if (resource->data[0] == 2) _tracks->channelCount++; @@ -1908,17 +1908,10 @@ SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan, SciVersi channel->data = resource->data + 0x21; channel->size = resource->size - 0x21; } - data = resource->data + 1; - for (channelNr = 0; channelNr < 16; channelNr++) { - channel = &_tracks->channels[channelNr]; - channel->number = channelNr; - channel->poly = *data >> 4; - data++; - } - if (_tracks->channelCount == 17) { + if (_tracks->channelCount == 2) { // Digital sample data included - _tracks->digitalChannelNr = 16; - sampleChannel = &_tracks->channels[16]; + _tracks->digitalChannelNr = 1; + sampleChannel = &_tracks->channels[1]; // we need to find 0xFC (channel terminator) within the data data = channel->data; dataEnd = channel->data + channel->size; diff --git a/engines/sci/sfx/midiparser.cpp b/engines/sci/sfx/midiparser.cpp index 893376433c..1b7565935a 100644 --- a/engines/sci/sfx/midiparser.cpp +++ b/engines/sci/sfx/midiparser.cpp @@ -26,6 +26,7 @@ #include "sci/engine/kernel.h" #include "sci/engine/state.h" #include "sci/sfx/midiparser.h" +#include "sci/sfx/softseq/mididriver.h" namespace Sci { @@ -41,8 +42,9 @@ enum SciMidiCommands { // MidiParser_SCI // -MidiParser_SCI::MidiParser_SCI() : +MidiParser_SCI::MidiParser_SCI(SciVersion soundVersion) : MidiParser() { + _soundVersion = soundVersion; _mixedData = NULL; // mididata contains delta in 1/60th second // values of ppqn and tempo are found experimentally and may be wrong @@ -476,10 +478,26 @@ void MidiParser_SCI::setVolume(byte bVolume) { if (_volume != bVolume) { _volume = bVolume; - // sending volume change to all active channels - for (int i = 0; i < _track->channelCount; i++) - if (_track->channels[i].number <= 0xF) - _driver->send(0xB0 + _track->channels[i].number, 7, _volume); + switch (_soundVersion) { + case SCI_VERSION_0_EARLY: + case SCI_VERSION_0_LATE: { + MidiPlayer *SCIDriver = (MidiPlayer *)_driver; + int16 globalVolume = _volume * 15 / 127; + SCIDriver->setVolume(globalVolume); + break; + } + + case SCI_VERSION_1_EARLY: + case SCI_VERSION_1_LATE: + // sending volume change to all active channels + for (int i = 0; i < _track->channelCount; i++) + if (_track->channels[i].number <= 0xF) + _driver->send(0xB0 + _track->channels[i].number, 7, _volume); + break; + + default: + error("MidiParser_SCI::setVolume: Unsupported soundVersion"); + } } } diff --git a/engines/sci/sfx/midiparser.h b/engines/sci/sfx/midiparser.h index 7f4945fdcf..0eb2eb0bc1 100644 --- a/engines/sci/sfx/midiparser.h +++ b/engines/sci/sfx/midiparser.h @@ -47,7 +47,7 @@ namespace Sci { class MidiParser_SCI : public MidiParser { public: - MidiParser_SCI(); + MidiParser_SCI(SciVersion soundVersion); ~MidiParser_SCI(); bool loadMusic(SoundResource::Track *track, MusicEntry *psnd, int channelFilterMask, SciVersion soundVersion); bool loadMusic(byte *, uint32) { diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 502b82478a..6f28aa0718 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -333,7 +333,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { _mutex.lock(); pSnd->soundType = Audio::Mixer::kMusicSoundType; if (pSnd->pMidiParser == NULL) { - pSnd->pMidiParser = new MidiParser_SCI(); + pSnd->pMidiParser = new MidiParser_SCI(_soundVersion); pSnd->pMidiParser->setMidiDriver(_pMidiDrv); pSnd->pMidiParser->setTimerRate(_dwTempo); pSnd->pMidiParser->property(MidiParser::mpCenterPitchWheelOnUnload, 1); diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 18c6ca5da2..453ff33757 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -666,9 +666,10 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) { switch (_argc) { case 2: // SCI0 + // SCI0 fades out all the time and when fadeout is done it will also stop the music from playing musicSlot->fadeTo = 0; musicSlot->fadeStep = -5; - musicSlot->fadeTickerStep = 0x10 * 16667 / _music->soundGetTempo(); + musicSlot->fadeTickerStep = 10 * 16667 / _music->soundGetTempo(); musicSlot->fadeTicker = 0; break; @@ -845,7 +846,11 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { if (musicSlot->fadeCompleted) { musicSlot->fadeCompleted = false; - PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET); + if (_soundVersion <= SCI_VERSION_0_LATE) { + cmdStopSound(obj, 0); + } else { + PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET); + } } // Sync loop selector for SCI0 |