From e56b44d1fa47574c1ff109f687caad13fec50150 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Mar 2007 18:45:54 +0000 Subject: cleanup svn-id: r26253 --- engines/scumm/imuse_digi/dimuse.h | 4 +-- engines/scumm/imuse_digi/dimuse_music.cpp | 4 +-- engines/scumm/imuse_digi/dimuse_track.cpp | 51 ++++++++++++++----------------- 3 files changed, 27 insertions(+), 32 deletions(-) (limited to 'engines/scumm/imuse_digi') diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index e2c2e6ecdf..f75ce4b214 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -134,7 +134,7 @@ private: int getSoundIdByName(const char *soundName); void fadeOutMusic(int fadeDelay); - Track *cloneToFadeOutTrack(Track *track, int fadeDelay); + Track *cloneToFadeOutTrack(const Track *track, int fadeDelay); void setFtMusicState(int stateId); void setFtMusicSequence(int seqId); @@ -212,7 +212,7 @@ struct imuseComiTable { char name[20]; byte atribPos; byte hookId; - int16 fadeOut60TicksDelay; + int16 fadeOutDelay; char filename[13]; }; diff --git a/engines/scumm/imuse_digi/dimuse_music.cpp b/engines/scumm/imuse_digi/dimuse_music.cpp index d9a922cc80..909f1e65db 100644 --- a/engines/scumm/imuse_digi/dimuse_music.cpp +++ b/engines/scumm/imuse_digi/dimuse_music.cpp @@ -314,7 +314,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab fadeOutMusic(60); return; } - fadeOutMusic(table->fadeOut60TicksDelay); + fadeOutMusic(table->fadeOutDelay); startMusic(table->filename, table->soundId, table->hookId, 127); break; case 3: @@ -324,7 +324,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab fadeOutMusic(60); return; } - fadeOutMusic(table->fadeOut60TicksDelay); + fadeOutMusic(table->fadeOutDelay); if ((!sequence) && (table->atribPos != 0) && (table->atribPos == _comiStateMusicTable[_curMusicState].atribPos)) { startMusic(table->filename, table->soundId, 0, 127); diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index bcc5623c66..b58d73c8d5 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -305,12 +305,12 @@ void IMuseDigital::fadeOutMusic(int fadeDelay) { } } -IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDelay) { +IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(const Track *track, int fadeDelay) { Common::StackLock lock(_mutex, "IMuseDigital::cloneToFadeOutTrack()"); assert(track); Track *fadeTrack = 0; - debug(5, "IMuseDigital::cloneToFadeOutTrack(%d, %d)", track->trackId, fadeDelay); + debug(0, "IMuseDigital::cloneToFadeOutTrack(%d, %d)", track->trackId, fadeDelay); if (_track[track->trackId + MAX_DIGITAL_TRACKS]->used) { warning("IMuseDigital::cloneToFadeOutTrack: Not free fade track"); @@ -318,45 +318,40 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDel } fadeTrack = _track[track->trackId + MAX_DIGITAL_TRACKS]; - fadeTrack->pan = track->pan; - fadeTrack->vol = track->vol; - fadeTrack->volGroupId = track->volGroupId; - fadeTrack->priority = track->priority; - fadeTrack->soundId = track->soundId; - fadeTrack->dataOffset = track->dataOffset; - fadeTrack->regionOffset = track->regionOffset; - fadeTrack->curRegion = track->curRegion; - fadeTrack->curHookId = track->curHookId; - fadeTrack->iteration = track->iteration; - fadeTrack->flags = track->flags; - fadeTrack->mod = track->mod; - fadeTrack->toBeRemoved = track->toBeRemoved; - fadeTrack->readyToRemove = track->readyToRemove; - fadeTrack->souStream = track->souStream; - fadeTrack->started = track->started; - fadeTrack->stream2 = track->stream2; - strcpy(fadeTrack->soundName, track->soundName); - fadeTrack->soundType = track->soundType; + + // Clone the settings of the given track + memcpy(fadeTrack, track, sizeof(Track)); + + // Clone the soundhandle fadeTrack->soundHandle = _sound->cloneSound(track->soundHandle); assert(fadeTrack->soundHandle); + // Set the volume fading parameters to indicate a fade out fadeTrack->volFadeDelay = fadeDelay; fadeTrack->volFadeDest = 0; fadeTrack->volFadeStep = (fadeTrack->volFadeDest - fadeTrack->vol) * 60 * (1000 / _callbackFps) / (1000 * fadeDelay); fadeTrack->volFadeUsed = true; - Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; - - if (fadeTrack->volGroupId == 1) + // Create an appendable output buffer + Audio::Mixer::SoundType type; + switch (fadeTrack->volGroupId) { + case 1: type = Audio::Mixer::kSpeechSoundType; - if (fadeTrack->volGroupId == 2) + break; + case 2: type = Audio::Mixer::kSFXSoundType; - if (fadeTrack->volGroupId == 3) + break; + case 3: type = Audio::Mixer::kMusicSoundType; - - // setup 1 second stream wrapped buffer + break; + default: + type = Audio::Mixer::kPlainSoundType; + break; + } fadeTrack->stream = Audio::makeAppendableAudioStream(_sound->getFreq(fadeTrack->soundHandle), makeMixerFlags(fadeTrack->flags)); _mixer->playInputStream(type, &fadeTrack->handle, fadeTrack->stream, -1, fadeTrack->vol / 1000, fadeTrack->pan, false); + + // Mark the track as, uhh, used & started (surprise, surprise :) fadeTrack->started = true; fadeTrack->used = true; -- cgit v1.2.3