aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2012-12-16 02:34:35 +0000
committerD G Turner2012-12-16 02:34:35 +0000
commit2c80977b13f5002ff8812ac9e0fd4c12e46fc625 (patch)
tree6341e13559379c1980431a9ccd211ea75f218575
parent702aecf12548a6113d3f1b4496c85dc199a58d6a (diff)
downloadscummvm-rg350-2c80977b13f5002ff8812ac9e0fd4c12e46fc625.tar.gz
scummvm-rg350-2c80977b13f5002ff8812ac9e0fd4c12e46fc625.tar.bz2
scummvm-rg350-2c80977b13f5002ff8812ac9e0fd4c12e46fc625.zip
TOUCHE: Fix external digital music support.
Thanks to clone2727 for pointing out the issue here. Tested with Valgrind and no leaks present. However, the music output is still not correct, when compared to Midi output. This is due to the track numbering. Either the external files need renaming or a mapping table will be needed.
-rw-r--r--engines/touche/touche.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 5338387be9..ada12099c3 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -3335,12 +3335,14 @@ void ToucheEngine::initMusic() {
void ToucheEngine::startMusic(int num) {
debug(1, "startMusic(%d)", num);
uint32 size;
+
+ stopMusic();
+
if (_midiPlayer) {
const uint32 offs = res_getDataOffset(kResourceTypeMusic, num, &size);
_fData.seek(offs);
_midiPlayer->play(_fData, size, true);
} else {
- _extMusicFile.close();
Common::String extMusicFilename = Common::String::format("track%02d.ogg", num);
if (!_extMusicFile.open(extMusicFilename)) {
error("Unable to open %s for reading", extMusicFilename.c_str());
@@ -3358,6 +3360,7 @@ void ToucheEngine::stopMusic() {
_midiPlayer->stop();
else {
_mixer->stopHandle(_musicHandle);
+ _extMusicFile.close();
}
}