aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2003-12-25 11:14:05 +0000
committerPaweł Kołodziejski2003-12-25 11:14:05 +0000
commit1abfe5d63f11d954278b9d987bde78770629fe78 (patch)
tree0c462c9e2b489a26be63385b047b90c063ff2e9a
parent9482d3b5a2c6516867011cf22ce07d83df8be1f9 (diff)
downloadscummvm-rg350-1abfe5d63f11d954278b9d987bde78770629fe78.tar.gz
scummvm-rg350-1abfe5d63f11d954278b9d987bde78770629fe78.tar.bz2
scummvm-rg350-1abfe5d63f11d954278b9d987bde78770629fe78.zip
start sound call directly digital imuse, only script part handled by mainloop of scumm script
svn-id: r11906
-rw-r--r--scumm/akos.cpp5
-rw-r--r--scumm/imuse_digi.cpp73
-rw-r--r--scumm/imuse_digi.h2
-rw-r--r--scumm/script_v6.cpp11
-rw-r--r--scumm/smush/insane.cpp7
-rw-r--r--scumm/sound.cpp27
6 files changed, 61 insertions, 64 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index 9dd2d08e2f..7098a3cbf8 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -1325,7 +1325,10 @@ void ScummEngine::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2)
break;
case 3:
if (param_1 != 0) {
- _sound->addSoundToQueue(param_1);
+ if (_features & GF_DIGI_IMUSE)
+ _sound->playSound(param_1);
+ else
+ _sound->addSoundToQueue(param_1);
}
break;
case 4:
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp
index 79e9dc53cb..d158d73e69 100644
--- a/scumm/imuse_digi.cpp
+++ b/scumm/imuse_digi.cpp
@@ -992,7 +992,7 @@ void IMuseDigital::pause(bool p) {
pauseBundleMusic(p);
}
-int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, int h) {
+void IMuseDigital::parseScriptQues(int a, int b, int c, int d, int e, int f, int g, int h) {
int cmd = a;
int sample = b;
int sub_cmd = c;
@@ -1000,17 +1000,17 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
int l, r;
if (!cmd)
- return 1;
+ return;
switch (cmd) {
case 10: // ImuseStopAllSounds
debug(5, "ImuseStopAllSounds()");
stopAllSounds();
- return 0;
+ return;
case 12: // ImuseSetParam
switch (sub_cmd) {
case 0x500: // set priority - could be ignored
- return 0;
+ return;
case 0x600: // set volume
debug(5, "ImuseSetParam (%x), sample(%d), volume(%d)", sub_cmd, sample, d);
for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
@@ -1021,12 +1021,12 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
}
if (chan == -1) {
debug(0, "ImuseSetParam (%x), sample(%d) not exist in channels", sub_cmd, sample);
- return 1;
+ return;
}
_channel[chan].vol = d * 1000;
if (_channel[chan].volFadeUsed)
_channel[chan].volFadeStep = (_channel[chan].volFadeDest - _channel[chan].vol) / (((1000 * _channel[chan].volFadeDelay) / 60) / 40);
- return 0;
+ return;
case 0x700: // set pan
debug(5, "ImuseSetParam (0x700), sample(%d), pan(%d)", sample, d);
for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
@@ -1037,13 +1037,13 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
}
if (chan == -1) {
debug(5, "ImuseSetParam (0x700), sample(%d) not exist in channels", sample);
- return 1;
+ return;
}
_channel[chan].pan = d;
- return 0;
+ return;
default:
warning("IMuseDigital::doCommand SetParam DEFAULT command %d", sub_cmd);
- return 1;
+ return;
}
case 14: // ImuseFadeParam
switch (sub_cmd) {
@@ -1051,7 +1051,7 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
debug(5, "ImuseFadeParam - fade sample(%d), to volume(%d) with 60hz ticks(%d)", sample, d, e);
if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) {
stopSound(sample);
- return 0;
+ return;
}
for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
if ((_channel[l].idSound == sample) && _channel[l].used) {
@@ -1061,17 +1061,17 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
}
if (chan == -1) {
debug(5, "ImuseFadeParam (0x600), sample %d not exist in channels", sample);
- return 1;
+ return;
}
_channel[chan].volFadeDelay = e;
_channel[chan].volFadeDest = d * 1000;
_channel[chan].volFadeStep = (_channel[chan].volFadeDest - _channel[chan].vol) / (((1000 * e) / 60) / 40);
_channel[chan].volFadeUsed = true;
debug(5, "ImuseFadeParam: vol %d, volDest %d, step %d", _channel[chan].vol, d * 1000, _channel[chan].volFadeStep);
- return 0;
+ return;
default:
warning("IMuseDigital::doCommand FadeParam DEFAULT sub command %d", sub_cmd);
- return 1;
+ return;
}
case 0x1000: // ImuseSetState
debug(5, "ImuseSetState (%d)", b);
@@ -1082,16 +1082,16 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
if (getSoundStatus(2) == 0)
startSound(2);
}
- return 0;
+ return;
}
if (_scumm->_gameId == GID_DIG) {
if (b == 1000) { // STATE_NULL
stopBundleMusic();
- return 0;
+ return;
}
for (l = 0;; l++) {
if (_digStateMusicMap[l].room == -1) {
- return 1;
+ return;
}
if (_digStateMusicMap[l].room == b) {
int music = _digStateMusicMap[l].table_index;
@@ -1100,7 +1100,7 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
(strcmp(_digStateMusicTable[_digStateMusicTable[music].unk3].filename, _nameBundleMusic) != 0) ) {
playBundleMusic(_digStateMusicTable[music].filename);
}
- return 0;
+ return;
}
}
} else if ((_scumm->_gameId == GID_CMI) && (_scumm->_features & GF_DEMO)) {
@@ -1116,29 +1116,29 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
playBundleMusic("gun.imx");
} else {
warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, this->_scumm->_currentRoom);
- return 1;
+ return;
}
} else if (_scumm->_gameId == GID_CMI) {
if (b == 1000) { // STATE_NULL
stopBundleMusic();
- return 0;
+ return;
}
for (l = 0;; l++) {
if (_comiStateMusicTable[l].id == -1) {
- return 1;
+ return;
}
if ((_comiStateMusicTable[l].id == b)) {
debug(5, "Play imuse music: %s, %s, %s", _comiStateMusicTable[l].name, _comiStateMusicTable[l].title, _comiStateMusicTable[l].filename);
if (_comiStateMusicTable[l].filename[0] != 0) {
playBundleMusic(_comiStateMusicTable[l].filename);
}
- return 0;
+ return;
}
}
} else if (_scumm->_gameId == GID_FT) {
for (l = 0;; l++) {
if (_ftStateMusicTable[l].index == -1) {
- return 1;
+ return;
}
if (_ftStateMusicTable[l].index == b) {
debug(5, "Play imuse music: %s, %s", _ftStateMusicTable[l].name, _ftStateMusicTable[l].audioname);
@@ -1146,46 +1146,46 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
for (r = 0; r < _scumm->_numAudioNames; r++) {
if (strcmp(_ftStateMusicTable[l].audioname, &_scumm->_audioNames[r * 9]) == 0) {
startSound(r);
- doCommand(12, r, 1536, _ftStateMusicTable[l].volume, 0, 0, 0, 0);
+ parseScriptQues(12, r, 1536, _ftStateMusicTable[l].volume, 0, 0, 0, 0);
}
}
}
}
}
}
- return 0;
+ return;
case 0x1001: // ImuseSetSequence
debug(5, "ImuseSetSequence (%d)", b);
if (_scumm->_gameId == GID_DIG) {
for (l = 0;; l++) {
if (_digSeqMusicTable[l].room == -1) {
- return 1;
+ return;
}
if ((_digSeqMusicTable[l].room == b)) {
debug(5, "Play imuse music: %s, %s, %s", _digSeqMusicTable[l].name, _digSeqMusicTable[l].title, _digSeqMusicTable[l].filename);
if (_digSeqMusicTable[l].filename[0] != 0) {
playBundleMusic(_digSeqMusicTable[l].filename);
}
- return 0;
+ return;
}
}
} else if (_scumm->_gameId == GID_CMI) {
for (l = 0;; l++) {
if (_comiSeqMusicTable[l].id == -1) {
- return 1;
+ return;
}
if ((_comiSeqMusicTable[l].id == b)) {
debug(5, "Play imuse music: %s, %s, %s", _comiSeqMusicTable[l].name, _comiSeqMusicTable[l].title, _comiSeqMusicTable[l].filename);
if (_comiSeqMusicTable[l].filename[0] != 0) {
playBundleMusic(_comiSeqMusicTable[l].filename);
}
- return 0;
+ return;
}
}
} else if (_scumm->_gameId == GID_FT) {
for (l = 0;; l++) {
if (_ftSeqMusicTable[l].index == -1) {
- return 1;
+ return;
}
if (_ftSeqMusicTable[l].index == b) {
debug(5, "Play imuse music: %s, %s", _ftSeqMusicTable[l].name, _ftSeqMusicTable[l].audioname);
@@ -1193,32 +1193,31 @@ int32 IMuseDigital::doCommand(int a, int b, int c, int d, int e, int f, int g, i
for (r = 0; r < _scumm->_numAudioNames; r++) {
if (strcmp(_ftSeqMusicTable[l].audioname, &_scumm->_audioNames[r * 9]) == 0) {
startSound(r);
- doCommand(12, r, 1536, _ftSeqMusicTable[l].volume, 0, 0, 0, 0);
+ parseScriptQues(12, r, 1536, _ftSeqMusicTable[l].volume, 0, 0, 0, 0);
}
}
}
}
}
}
- return 0;
+ return;
case 0x1002: // ImuseSetCuePoint
debug(5, "ImuseSetCuePoint (%d)", b);
- return 0;
+ return;
case 0x1003: // ImuseSetAttribute
debug(5, "ImuseSetAttribute (%d, %d)", b, c);
- return 0;
+ return;
case 0x2000: // ImuseSetMasterSFXVolume
debug(5, "ImuseSetMasterSFXVolume (%d)", b);
- return 0;
+ return;
case 0x2001: // ImuseSetMasterVoiceVolume
debug(5, "ImuseSetMasterVoiceVolume (%d)", b);
- return 0;
+ return;
case 0x2002: // ImuseSetMasterMusicVolume
debug(5, "ImuseSetMasterMusicVolume (%d)", b);
- return 0;
+ return;
default:
warning("IMuseDigital::doCommand DEFAULT command %d", cmd);
- return 1;
}
}
diff --git a/scumm/imuse_digi.h b/scumm/imuse_digi.h
index a083f58ad4..199ab652a1 100644
--- a/scumm/imuse_digi.h
+++ b/scumm/imuse_digi.h
@@ -141,7 +141,7 @@ public:
void stopSound(int sound);
void stopAllSounds();
void pause(bool pause);
- int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
+ void parseScriptQues(int a, int b, int c, int d, int e, int f, int g, int h);
int getSoundStatus(int sound) const;
};
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index e8311b9cba..117253d5c1 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -930,7 +930,11 @@ void ScummEngine_v6::o6_getOwner() {
void ScummEngine_v6::o6_startSound() {
if ((_features & GF_HUMONGOUS) && (_gameId != GID_PUTTDEMO))
pop(); // offset which seems to always be zero
- _sound->addSoundToQueue(pop());
+
+ if (_features & GF_DIGI_IMUSE)
+ _sound->playSound(pop());
+ else
+ _sound->addSoundToQueue(pop());
}
void ScummEngine_v6::o6_stopSound() {
@@ -938,7 +942,10 @@ void ScummEngine_v6::o6_stopSound() {
}
void ScummEngine_v6::o6_startMusic() {
- _sound->addSoundToQueue(pop());
+ if (_features & GF_DIGI_IMUSE)
+ _sound->playSound(pop());
+ else
+ _sound->addSoundToQueue(pop());
}
void ScummEngine_v6::o6_stopObjectScript() {
diff --git a/scumm/smush/insane.cpp b/scumm/smush/insane.cpp
index f7c8692533..bf187ff272 100644
--- a/scumm/smush/insane.cpp
+++ b/scumm/smush/insane.cpp
@@ -5923,7 +5923,7 @@ bool Insane::smlayer_startSound1(int32 sound) {
// 4 - background music)
// there are no equivalents in scummvm
if (smlayer_loadSound(sound, 0, 2)) {
- _scumm->_sound->addSoundToQueue(readArray(_numberArray, sound));
+ _scumm->_sound->playSound(readArray(_numberArray, sound));
return true;
} else
return false;
@@ -5938,18 +5938,17 @@ bool Insane::smlayer_startSound2(int32 sound) {
// 4 - background music)
// there are no equivalents in scummvm
if (smlayer_loadSound(sound, 0, 2)) {
- _scumm->_sound->addSoundToQueue(readArray(_numberArray, sound));
+ _scumm->_sound->playSound(readArray(_numberArray, sound));
return true;
} else
return false;
}
void Insane::smlayer_soundSetPan(int32 soundid, int32 pan) {
- _scumm->_imuseDigital->doCommand(12, soundid, 0x700, pan, 0, 0, 0, 0);
+ _scumm->_imuseDigital->parseScriptQues(12, soundid, 0x700, pan, 0, 0, 0, 0);
}
void Insane::smlayer_soundSetPriority(int32 sound, int32 priority) {
- // FIXME: waits for complete iMUSE digital
}
void Insane::smlayer_drawSomething(byte *renderBitmap, int32 codecparam,
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index bdb6bdc2d0..ca384df0d7 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -66,16 +66,9 @@ Sound::~Sound() {
}
void Sound::addSoundToQueue(int sound) {
- if (!(_scumm->_features & GF_DIGI_IMUSE)) {
- _scumm->VAR(_scumm->VAR_LAST_SOUND) = sound;
- _scumm->ensureResourceLoaded(rtSound, sound);
- addSoundToQueue2(sound);
- } else {
- // WARNING ! This may break something, maybe this sould be put inside if (_gameID == GID_FT || _gameID == GID_FTDEMO) ?
- // But why addSoundToQueue should not queue sound ?
- _scumm->ensureResourceLoaded(rtSound, sound);
- addSoundToQueue2(sound);
- }
+ _scumm->VAR(_scumm->VAR_LAST_SOUND) = sound;
+ _scumm->ensureResourceLoaded(rtSound, sound);
+ addSoundToQueue2(sound);
}
void Sound::addSoundToQueue2(int sound) {
@@ -107,17 +100,13 @@ void Sound::processSoundQues() {
data[j] = _soundQue[i + j];
i += num;
-#if 0
- debug(1, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
- data[0] >> 8,
- data[0] & 0xFF,
- data[1], data[2], data[3], data[4], data[5], data[6], data[7]
- );
-#endif
-
+ debug(5, "processSoundQues(%d,%d,%d,%d,%d,%d,%d,%d,%d)",
+ data[0] >> 8, data[0] & 0xFF,
+ data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
+
if (_scumm->_features & GF_DIGI_IMUSE) {
if (_scumm->_imuseDigital)
- _scumm->_imuseDigital->doCommand(data[0], data[1], data[2], data[3], data[4],
+ _scumm->_imuseDigital->parseScriptQues(data[0], data[1], data[2], data[3], data[4],
data[5], data[6], data[7]);
} else if (_scumm->_imuse) {
_scumm->VAR(_scumm->VAR_SOUNDRESULT) = (short)_scumm->_imuse->doCommand (num, data);