diff options
author | Paweł Kołodziejski | 2005-03-12 18:54:06 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2005-03-12 18:54:06 +0000 |
commit | 8de216f3aec1dcee16fc0ab9974da4087bac5252 (patch) | |
tree | cf13f0cf2cef7701e5aee5a5b88e4389e462d5f0 /scumm | |
parent | 65551ca83ecac3cbaed890146c17b09f6aa05903 (diff) | |
download | scummvm-rg350-8de216f3aec1dcee16fc0ab9974da4087bac5252.tar.gz scummvm-rg350-8de216f3aec1dcee16fc0ab9974da4087bac5252.tar.bz2 scummvm-rg350-8de216f3aec1dcee16fc0ab9974da4087bac5252.zip |
some experimental changes
svn-id: r17105
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 3 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_music.cpp | 35 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_track.cpp | 37 |
3 files changed, 64 insertions, 11 deletions
diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index dcec24b109..bbdc56a089 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -144,6 +144,9 @@ public: void setVolume(int soundId, int volume); void setPan(int soundId, int pan); void setFade(int soundId, int destVolume, int delay60HzTicks); + int getCurMusicSoundId(); + char *getCurMusicSoundName(); + void setHookId(int soundId, int hookId); void setMusicVolume(int vol) {} void stopSound(int sound); void stopAllSounds(); diff --git a/scumm/imuse_digi/dimuse_music.cpp b/scumm/imuse_digi/dimuse_music.cpp index da57398353..547b6ab605 100644 --- a/scumm/imuse_digi/dimuse_music.cpp +++ b/scumm/imuse_digi/dimuse_music.cpp @@ -286,27 +286,40 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab switch(table->opcode) { case 0: - case 8: - case 9: fadeOutMusic(120); break; + case 8: + case 9: + { + int soundId = getCurMusicSoundId(); + setHookId(soundId, hookId); + break; + } case 1: + fadeOutMusic(120); 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); - return; + { + if (table->filename[0] == 0) { + fadeOutMusic(60); + return; + } + char *soundName = getCurMusicSoundName(); + if ((strcmp(soundName, table->filename) == 0)) { + int soundId = getCurMusicSoundId(); + setFade(soundId, 127, table->fadeOut60TicksDelay); + setHookId(soundId, hookId); + } else { + fadeOutMusic(120); + startMusic(table->filename, table->soundId, table->hookId, 127); + } + break; } - fadeOutMusic(table->fadeOut60TicksDelay); - startMusic(table->filename, table->soundId, table->hookId, 127); - break; case 3: case 4: case 12: @@ -314,9 +327,9 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab fadeOutMusic(60); return; } - fadeOutMusic(table->fadeOut60TicksDelay); if ((!sequence) && (table->atribPos != 0) && (table->atribPos == _comiStateMusicTable[_curMusicState].atribPos)) { + fadeOutMusic(table->fadeOut60TicksDelay); startMusic(table->filename, table->soundId, 0, 127); return; } diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp index 87072a8fd0..ab80e92db2 100644 --- a/scumm/imuse_digi/dimuse_track.cpp +++ b/scumm/imuse_digi/dimuse_track.cpp @@ -206,6 +206,43 @@ void IMuseDigital::setVolume(int soundId, int volume) { } } +void IMuseDigital::setHookId(int soundId, int hookId) { + Common::StackLock lock(_mutex, "IMuseDigital::setHookId()"); + + for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { + Track *track = _track[l]; + if ((track->soundId == soundId) && track->used && !track->toBeRemoved) { + track->curHookId = hookId; + } + } +} + +int IMuseDigital::getCurMusicSoundId() { + int soundId = -1; + + for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { + Track *track = _track[l]; + if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) { + soundId = track->soundId; + } + } + + return soundId; +} + +char *IMuseDigital::getCurMusicSoundName() { + char *soundName = NULL; + + for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { + Track *track = _track[l]; + if (track->used && !track->toBeRemoved && (track->volGroupId == IMUSE_VOLGRP_MUSIC)) { + soundName = track->soundName; + } + } + + return soundName; +} + void IMuseDigital::setPan(int soundId, int pan) { debug(5, "IMuseDigital::setPan(%d, %d)", soundId, pan); |