diff options
author | Paweł Kołodziejski | 2008-01-13 01:03:15 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2008-01-13 01:03:15 +0000 |
commit | 94834008125a625292a905f048e64328ee4416e7 (patch) | |
tree | dbe4bce454baca4e10f30444db1c53b82d384539 /engines/scumm | |
parent | d27c118acc455b57ba988b0bbbb681fc36914ee9 (diff) | |
download | scummvm-rg350-94834008125a625292a905f048e64328ee4416e7.tar.gz scummvm-rg350-94834008125a625292a905f048e64328ee4416e7.tar.bz2 scummvm-rg350-94834008125a625292a905f048e64328ee4416e7.zip |
fixed fadeOutMusic in transitions
svn-id: r30465
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.h | 1 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_music.cpp | 33 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_track.cpp | 16 |
3 files changed, 34 insertions, 16 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index 372bfb7ab4..6f37f7258c 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -149,6 +149,7 @@ private: int getSoundIdByName(const char *soundName); void fadeOutMusic(int fadeDelay); + void updateMusicFadeTrack(int fadeDelay); Track *cloneToFadeOutTrack(Track *track, int fadeDelay); void setFtMusicState(int stateId); diff --git a/engines/scumm/imuse_digi/dimuse_music.cpp b/engines/scumm/imuse_digi/dimuse_music.cpp index 3def3be747..0871f92f5b 100644 --- a/engines/scumm/imuse_digi/dimuse_music.cpp +++ b/engines/scumm/imuse_digi/dimuse_music.cpp @@ -169,6 +169,9 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table fadeOutMusic(120); + if (!songName) + updateMusicFadeTrack(120); + switch (table->transitionType) { case 0: case 5: @@ -176,14 +179,17 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table case 3: case 4: if (table->filename[0] == 0) { + updateMusicFadeTrack(60); return; } if (table->transitionType == 4) _stopingSequence = true; if ((!sequence) && (table->attribPos != 0) && (table->attribPos == _digStateMusicTable[_curMusicState].attribPos)) { + updateMusicFadeTrack(108); startMusic(table->filename, table->soundId, 0, 127); } else { + updateMusicFadeTrack(108); startMusic(table->filename, table->soundId, hookId, 127); } break; @@ -287,9 +293,13 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab } } + fadeOutMusic(120); + + if (!songName) + updateMusicFadeTrack(120); + switch (table->transitionType) { case 0: - fadeOutMusic(120); break; case 8: setHookId(table->soundId, table->hookId); @@ -298,41 +308,32 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab _stopingSequence = true; setHookId(table->soundId, table->hookId); break; - case 1: - if (table->filename[0] == 0) { - fadeOutMusic(120); - return; - } - fadeOutMusic(120); - startMusic(table->filename, table->soundId, 0, 1); - setFade(table->soundId, 127, 120); - break; case 2: if (table->filename[0] == 0) { - fadeOutMusic(60); + updateMusicFadeTrack(60); return; } - fadeOutMusic(table->fadeOutDelay); + updateMusicFadeTrack(table->fadeOutDelay); startMusic(table->filename, table->soundId, table->hookId, 127); break; case 3: case 4: case 12: if (table->filename[0] == 0) { - fadeOutMusic(60); + updateMusicFadeTrack(60); return; } if (table->transitionType == 4) _stopingSequence = true; if ((!sequence) && (table->attribPos != 0) && (table->attribPos == _comiStateMusicTable[_curMusicState].attribPos)) { - fadeOutMusic(120); // expiremental fadeDelay 120 instead from table + updateMusicFadeTrack(120); // expiremental fadeDelay 120 instead from table startMusic(table->filename, table->soundId, 0, 127); } else if (table->transitionType == 12) { - fadeOutMusic(table->fadeOutDelay); + updateMusicFadeTrack(table->fadeOutDelay); startMusic(table->filename, table->soundId, table->hookId, 127); } else { - fadeOutMusic(table->fadeOutDelay); + updateMusicFadeTrack(table->fadeOutDelay); startMusic(table->filename, table->soundId, hookId, 127); } break; diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index b2037d83fc..e049b09427 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -280,6 +280,22 @@ void IMuseDigital::fadeOutMusic(int fadeDelay) { } } +void IMuseDigital::updateMusicFadeTrack(int fadeDelay) { + Common::StackLock lock(_mutex, "IMuseDigital::updateMusicFadeTrack()"); + debug(5, "IMuseDigital::updateMusicFadeTrack"); + + for (int l = MAX_DIGITAL_TRACKS; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) { + Track *track = _track[l]; + if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) { + track->volFadeDelay = fadeDelay; + track->volFadeDest = 0; + track->volFadeStep = (track->volFadeDest - track->vol) * 60 * (1000 / _callbackFps) / (1000 * fadeDelay); + track->volFadeUsed = true; + } + } +} + + IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDelay) { assert(track); Track *fadeTrack = 0; |