aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/imuse_digi/dimuse.cpp5
-rw-r--r--scumm/imuse_digi/dimuse_track.cpp15
2 files changed, 18 insertions, 2 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp
index 944cd32592..27bbedc8d0 100644
--- a/scumm/imuse_digi/dimuse.cpp
+++ b/scumm/imuse_digi/dimuse.cpp
@@ -145,7 +145,7 @@ void IMuseDigital::saveOrLoad(Serializer *ser) {
int freq = _sound->getFreq(track->soundHandle);
track->stream2 = NULL;
track->stream = makeAppendableAudioStream(freq, track->mixerFlags, streamBufferSize);
- _vm->_mixer->playInputStream(&track->handle, track->stream, false, track->vol / 1000, track->pan, -1);
+ _vm->_mixer->playInputStream(&track->handle, track->stream, false, track->mixerVol, track->mixerPan, -1);
}
}
}
@@ -198,6 +198,9 @@ void IMuseDigital::callback() {
if (track->volGroupId == 3)
vol = (vol * _volMusic) / 128;
+ track->mixerVol = vol;
+ track->mixerPan = pan;
+
if (_vm->_mixer->isReady()) {
if (track->stream2) {
if (!track->started) {
diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp
index c9dfad79bb..df9cd74c63 100644
--- a/scumm/imuse_digi/dimuse_track.cpp
+++ b/scumm/imuse_digi/dimuse_track.cpp
@@ -155,11 +155,24 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
track->stream = NULL;
track->started = false;
} else {
+ int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0;
+ int vol = track->vol / 1000;
+
+ if (track->volGroupId == 1)
+ vol = (vol * _volVoice) / 128;
+ if (track->volGroupId == 2)
+ vol = (vol * _volSfx) / 128;
+ if (track->volGroupId == 3)
+ vol = (vol * _volMusic) / 128;
+
+ track->mixerPan = pan;
+ track->mixerVol = vol;
+
// setup 1 second stream wrapped buffer
int32 streamBufferSize = track->iteration;
track->stream2 = NULL;
track->stream = makeAppendableAudioStream(freq, track->mixerFlags, streamBufferSize);
- _vm->_mixer->playInputStream(&track->handle, track->stream, false, track->vol / 1000, track->pan, -1);
+ _vm->_mixer->playInputStream(&track->handle, track->stream, false, track->mixerVol, track->mixerPan, -1);
track->started = true;
}