aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/imuse.cpp14
-rw-r--r--scumm/imuse.h1
-rw-r--r--scumm/saveload.cpp4
-rw-r--r--scumm/script_v2.cpp3
4 files changed, 21 insertions, 1 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 9325011df9..cae65cdfaf 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -4862,6 +4862,7 @@ void IMuseDigital::handler() {
if (_channel[l]._toBeRemoved == true) {
_channel[l]._used = false;
free(_channel[l]._data);
+ memset(&_channel[l], 0, sizeof(channel));
continue;
}
@@ -5043,8 +5044,19 @@ void IMuseDigital::startSound(int sound) {
void IMuseDigital::stopSound(int sound) {
debug(1, "IMuseDigital::stopSound(%d)", sound);
- for (int32 l = 0; l < MAX_DIGITAL_CHANNELS;l ++) {
+ for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
if ((_channel[l]._idSound == sound) && (_channel[l]._used == true)) {
+ if (_channel[l]._isLoop == false)
+ _channel[l]._toBeRemoved = true;
+ else
+ _channel[l]._isLoop = false;
+ }
+ }
+}
+
+void IMuseDigital::stopAll() {
+ for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
+ if (_channel[l]._used == true) {
_channel[l]._toBeRemoved = true;
}
}
diff --git a/scumm/imuse.h b/scumm/imuse.h
index 1723d8e570..7aa61ed190 100644
--- a/scumm/imuse.h
+++ b/scumm/imuse.h
@@ -110,6 +110,7 @@ public:
void handler();
void startSound(int sound);
void stopSound(int sound);
+ void stopAll();
int32 doCommand(int a, int b, int c, int d, int e, int f, int g, int h);
int getSoundStatus(int sound);
};
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index fadcc28645..bdbdb03516 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -111,6 +111,10 @@ bool Scumm::loadState(int slot, bool compat)
_current_version = hdr.ver;
memcpy(_saveLoadName, hdr.name, sizeof(hdr.name));
+ if (_imuseDigital) {
+ _imuseDigital->stopAll();
+ }
+
_sound->pauseSounds(true);
CHECK_HEAP openRoom(-1);
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 9793349dad..c79af8acac 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -2714,6 +2714,9 @@ void Scumm::o6_miscOps()
grabCursor(args[1], args[2], args[3], args[4]);
break;
case 6: {
+ if (_imuseDigital) {
+ _imuseDigital->stopAll();
+ }
uint32 speed;
if (strcmp((char*)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0)
speed = 71;