aboutsummaryrefslogtreecommitdiff
path: root/scumm/imuse_digi
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-01-18 11:39:29 +0000
committerPaweł Kołodziejski2004-01-18 11:39:29 +0000
commitb9e93634fb3c8d046ad4e6c9c2fdd02328bf3d04 (patch)
tree5f031cc20d0e7dab94cf58d66577c26cb7c039c5 /scumm/imuse_digi
parent4a0ec9638eab991e9f74731e0f2bc8e1956af20d (diff)
downloadscummvm-rg350-b9e93634fb3c8d046ad4e6c9c2fdd02328bf3d04.tar.gz
scummvm-rg350-b9e93634fb3c8d046ad4e6c9c2fdd02328bf3d04.tar.bz2
scummvm-rg350-b9e93634fb3c8d046ad4e6c9c2fdd02328bf3d04.zip
next cleanup
svn-id: r12472
Diffstat (limited to 'scumm/imuse_digi')
-rw-r--r--scumm/imuse_digi/dimuse.cpp31
-rw-r--r--scumm/imuse_digi/dimuse.h18
-rw-r--r--scumm/imuse_digi/dimuse_music.cpp39
3 files changed, 44 insertions, 44 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp
index 64e9440bb3..0a66c3950b 100644
--- a/scumm/imuse_digi/dimuse.cpp
+++ b/scumm/imuse_digi/dimuse.cpp
@@ -236,7 +236,7 @@ void IMuseDigital::switchToNextRegion(int track) {
_track[track].regionOffset = 0;
}
-void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId) {
+void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume) {
Common::StackLock lock(_mutex);
debug(5, "IMuseDigital::startSound(%d)", soundId);
int l;
@@ -244,7 +244,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
for (l = 0; l < MAX_DIGITAL_TRACKS; l++) {
if (!_track[l].used && !_track[l].handle.isActive()) {
_track[l].pan = 64;
- _track[l].vol = 127 * 1000;
+ _track[l].vol = volume * 1000;
_track[l].volFadeDest = 0;
_track[l].volFadeStep = 0;
_track[l].volFadeDelay = 0;
@@ -385,6 +385,19 @@ void IMuseDigital::stopAllSounds(bool waitForStop) {
}*/
}
+void IMuseDigital::fadeOutMusic(int fadeDelay) {
+ Common::StackLock lock(_mutex);
+ debug(5, "IMuseDigital::fadeOutMusic");
+ for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
+ if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
+ _track[l].volFadeDelay = fadeDelay;
+ _track[l].volFadeDest = 0;
+ _track[l].volFadeStep = (_track[l].volFadeDest - _track[l].vol) * 60 * 40 / (1000 * fadeDelay);
+ _track[l].volFadeUsed = true;
+ }
+ }
+}
+
void IMuseDigital::pause(bool p) {
Common::StackLock lock(_mutex);
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
@@ -447,29 +460,29 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int
if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) {
if (b == 1) {
fadeOutMusic(120);
- startMusic(1, false);
+ startMusic(1, false, 127);
} else {
if (getSoundStatus(2) == 0) {
fadeOutMusic(120);
- startMusic(2, false);
+ startMusic(2, false, 127);
}
}
} else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) {
if (b == 2) {
fadeOutMusic(120);
- startMusic("in1.imx", 2002, false, 0);
+ startMusic("in1.imx", 2002, false, 0, 127);
} else if (b == 4) {
fadeOutMusic(120);
- startMusic("in2.imx", 2004, false, 0);
+ startMusic("in2.imx", 2004, false, 0, 127);
} else if (b == 8) {
fadeOutMusic(120);
- startMusic("out1.imx", 2008, false, 0);
+ startMusic("out1.imx", 2008, false, 0, 127);
} else if (b == 9) {
fadeOutMusic(120);
- startMusic("out2.imx", 2009, false, 0);
+ startMusic("out2.imx", 2009, false, 0, 127);
} else if (b == 16) {
fadeOutMusic(120);
- startMusic("gun.imx", 2016, false, 0);
+ startMusic("gun.imx", 2016, false, 0, 127);
} else {
warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, this->_vm->_currentRoom);
}
diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h
index 86b1d18c44..a29b56a19b 100644
--- a/scumm/imuse_digi/dimuse.h
+++ b/scumm/imuse_digi/dimuse.h
@@ -90,7 +90,7 @@ private:
static void timer_handler(void *refConf);
void callback();
void switchToNextRegion(int track);
- void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId);
+ void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, bool sequence, int hookId, int volume);
int32 getPosInMs(int soundId);
void getLipSync(int soundId, int syncId, int32 msPos, int32 &width, int32 &height);
@@ -116,17 +116,17 @@ public:
virtual ~IMuseDigital();
void startVoice(int soundId, AudioStream *input)
- { debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, false, 0); }
+ { debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, NULL, 0, IMUSE_VOICE, input, false, 0, 127); }
void startVoice(int soundId)
- { debug(5, "startVoiceBundle(%d)", soundId); startSound(soundId, NULL, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0); }
+ { debug(5, "startVoiceBundle(%d)", soundId); startSound(soundId, NULL, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0, 127); }
void startVoice(int soundId, const char *soundName)
- { debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0); }
- void startMusic(int soundId, bool sequence)
- { debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, sequence, 0); }
- void startMusic(const char *soundName, int soundId, bool sequence, int hookId)
- { debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, sequence, hookId); }
+ { debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL, false, 0, 127); }
+ void startMusic(int soundId, bool sequence, int volume)
+ { debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL, sequence, 0, volume); }
+ void startMusic(const char *soundName, int soundId, bool sequence, int hookId, int volume)
+ { debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL, sequence, hookId, volume); }
void startSfx(int soundId)
- { debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, false, 0); }
+ { debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL, false, 0, 127); }
void startSound(int soundId)
{ error("MusicEngine::startSound() Should be never called"); }
diff --git a/scumm/imuse_digi/dimuse_music.cpp b/scumm/imuse_digi/dimuse_music.cpp
index 78170ddb66..7959896b18 100644
--- a/scumm/imuse_digi/dimuse_music.cpp
+++ b/scumm/imuse_digi/dimuse_music.cpp
@@ -168,13 +168,13 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table
case 3:
if ((!sequence) && (table->param != 0)) {
if (table->param == _digStateMusicTable[_curMusicState].param) {
- startMusic(table->filename, table->soundId, sequence, 0);
+ startMusic(table->filename, table->soundId, sequence, 0, 127);
}
} else {
- startMusic(table->filename, table->soundId, sequence, hookId);
+ startMusic(table->filename, table->soundId, sequence, hookId, 127);
}
case 4:
- startMusic(table->filename, table->soundId, sequence, 0);
+ startMusic(table->filename, table->soundId, sequence, 0, 127);
break;
}
}
@@ -287,9 +287,8 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
break;
case 1:
fadeOutMusic(120);
- startMusic(table->filename, table->soundId, sequence, 0);
- parseScriptCmds(12, table->soundId, 0x600, 1, 0, 0, 0, 0);
- parseScriptCmds(14, table->soundId, 0x600, 127, 120, 0, 0, 0);
+ startMusic(table->filename, table->soundId, sequence, 0, 1);
+ setFade(table->soundId, 127, 120);
break;
case 2:
{
@@ -297,7 +296,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
if (fadeDelay == 0)
fadeDelay = 1000;
fadeOutMusic(fadeDelay);
- startMusic(table->filename, table->soundId, sequence, table->hookId);
+ startMusic(table->filename, table->soundId, sequence, table->hookId, 127);
}
break;
case 3:
@@ -307,18 +306,18 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
if (fadeDelay == 0)
fadeDelay = 1000;
fadeOutMusic(fadeDelay);
- startMusic(table->filename, table->soundId, sequence, 0);
+ startMusic(table->filename, table->soundId, sequence, 0, 127);
}
} else {
int fadeDelay = table->fadeDelay;
if (fadeDelay == 0)
fadeDelay = 1000;
fadeOutMusic(fadeDelay);
- startMusic(table->filename, table->soundId, sequence, table->hookId);
+ startMusic(table->filename, table->soundId, sequence, table->hookId, 127);
}
case 4:
fadeOutMusic(120);
- startMusic(table->filename, table->soundId, sequence, 0);
+ startMusic(table->filename, table->soundId, sequence, 0, 127);
break;
case 12:
{
@@ -326,7 +325,7 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab
if (fadeDelay == 0)
fadeDelay = 1000;
fadeOutMusic(fadeDelay);
- startMusic(table->filename, table->soundId, sequence, table->hookId);
+ startMusic(table->filename, table->soundId, sequence, table->hookId, 127);
}
break;
}
@@ -411,16 +410,6 @@ int IMuseDigital::getSoundIdByName(const char *soundName) {
return -1;
}
-void IMuseDigital::fadeOutMusic(int fadeDelay) {
- Common::StackLock lock(_mutex);
- debug(5, "IMuseDigital::fadeOutMusic");
- for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
- if (_track[l].used) {
- parseScriptCmds(14, _track[l].soundId, 0x600, 0, fadeDelay, 0, 0, 0);
- }
- }
-}
-
void IMuseDigital::playFtMusic(const char *songName, int opcode, int volume, bool sequence) {
fadeOutMusic(200);
@@ -432,11 +421,9 @@ void IMuseDigital::playFtMusic(const char *songName, int opcode, int volume, boo
case 2:
case 3:
{
- int soundId = getSoundIdByName(songName);
- if (soundId != -1) {
- startMusic(soundId, sequence);
- parseScriptCmds(12, soundId, 0x600, volume, 0, 0, 0, 0);
- }
+ int soundId = getSoundIdByName(songName);
+ if (soundId != -1)
+ startMusic(soundId, sequence, volume);
}
break;
}