aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/imuse_digi
diff options
context:
space:
mode:
authorMax Horn2007-03-20 18:45:54 +0000
committerMax Horn2007-03-20 18:45:54 +0000
commite56b44d1fa47574c1ff109f687caad13fec50150 (patch)
tree13efb180fc9b2333579177f86b7f6fb78c66afe8 /engines/scumm/imuse_digi
parent2dc7cb2cd49c20a5f6bcfe5446fb8340f6a555c8 (diff)
downloadscummvm-rg350-e56b44d1fa47574c1ff109f687caad13fec50150.tar.gz
scummvm-rg350-e56b44d1fa47574c1ff109f687caad13fec50150.tar.bz2
scummvm-rg350-e56b44d1fa47574c1ff109f687caad13fec50150.zip
cleanup
svn-id: r26253
Diffstat (limited to 'engines/scumm/imuse_digi')
-rw-r--r--engines/scumm/imuse_digi/dimuse.h4
-rw-r--r--engines/scumm/imuse_digi/dimuse_music.cpp4
-rw-r--r--engines/scumm/imuse_digi/dimuse_track.cpp51
3 files changed, 27 insertions, 32 deletions
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;