From 2c80977b13f5002ff8812ac9e0fd4c12e46fc625 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 16 Dec 2012 02:34:35 +0000 Subject: 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. --- engines/touche/touche.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines/touche/touche.cpp') 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(); } } -- cgit v1.2.3