New music code: Implemented sound stopping after fading, and disabled MIDI sound volume fading, till we figure out what's wrong with fading in the Sierra logo screen in GK1

svn-id: r47252
This commit is contained in:
Filippos Karapetis 2010-01-11 14:26:13 +00:00
parent 6d53dfe917
commit 70694f9858
3 changed files with 14 additions and 2 deletions

View File

@ -36,6 +36,9 @@
namespace Sci {
// When defined, volume fading immediately sets the final sound volume
#define DISABLE_VOLUME_FADING
SciMusic::SciMusic(SciVersion soundVersion)
: _soundVersion(soundVersion), _soundOn(true) {
@ -513,6 +516,7 @@ MusicEntry::MusicEntry() {
fadeTickerStep = 0;
fadeSetVolume = false;
fadeCompleted = false;
stopAfterFading = false;
status = kSoundStopped;
@ -557,7 +561,11 @@ void MusicEntry::doFade() {
// Only process MIDI streams in this thread, not digital sound effects
if (pMidiParser)
#ifndef DISABLE_VOLUME_FADING
pMidiParser->setVolume(volume);
#else
pMidiParser->setVolume(fadeTo);
#endif
fadeSetVolume = true; // set flag so that SoundCommandParser::cmdUpdateCues will set the volume of the stream
}
}

View File

@ -95,6 +95,7 @@ public:
uint32 fadeTickerStep;
bool fadeSetVolume;
bool fadeCompleted;
bool stopAfterFading;
SoundStatus status;

View File

@ -669,12 +669,13 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) {
musicSlot->fadeTicker = 0;
break;
case 5: // Possibly SCI1?!
case 6: // SCI 1.1 TODO: find out what additional parameter is
case 5: // SCI01+
case 6: // SCI1+ (SCI1 late sound scheme), with fade and continue
musicSlot->fadeTo = CLIP<uint16>(_argv[2].toUint16(), 0, MUSIC_VOLUME_MAX);
musicSlot->fadeStep = volume > _argv[2].toUint16() ? -_argv[4].toUint16() : _argv[4].toUint16();
musicSlot->fadeTickerStep = _argv[3].toUint16() * 16667 / _music->soundGetTempo();
musicSlot->fadeTicker = 0;
musicSlot->stopAfterFading = (_argc == 6) ? (_argv[5].toUint16() != 0) : false;
break;
default:
@ -846,6 +847,8 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
cmdStopSound(obj, 0);
} else {
PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
if (musicSlot->stopAfterFading)
cmdStopSound(obj, 0);
}
}