aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/kyra_lok.cpp9
-rw-r--r--engines/kyra/kyra_lok.h3
-rw-r--r--engines/kyra/kyra_v1.cpp7
-rw-r--r--engines/kyra/module.mk1
-rw-r--r--engines/kyra/seqplayer.cpp5
-rw-r--r--engines/kyra/sequences_lok.cpp10
-rw-r--r--engines/kyra/sound.cpp7
-rw-r--r--engines/kyra/sound.h3
-rw-r--r--engines/kyra/sound_amiga.cpp239
-rw-r--r--engines/kyra/sound_intern.h30
-rw-r--r--engines/kyra/staticres.cpp180
-rw-r--r--engines/scumm/module.mk1
-rw-r--r--engines/scumm/music.h6
-rw-r--r--engines/scumm/player_v4a.cpp193
-rw-r--r--engines/scumm/player_v4a.h98
-rw-r--r--engines/scumm/scumm.cpp21
-rw-r--r--engines/scumm/scumm.h1
-rw-r--r--engines/scumm/sound.cpp20
18 files changed, 778 insertions, 56 deletions
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index 36f134d9e4..fc19b2fb65 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -183,8 +183,13 @@ Common::Error KyraEngine_LoK::init() {
_sound->setSoundList(&_soundData[kMusicIntro]);
- _trackMap = _dosTrackMap;
- _trackMapSize = _dosTrackMapSize;
+ if (_flags.platform == Common::kPlatformAmiga) {
+ _trackMap = _amigaTrackMap;
+ _trackMapSize = _amigaTrackMapSize;
+ } else {
+ _trackMap = _dosTrackMap;
+ _trackMapSize = _dosTrackMapSize;
+ }
if (!_sound->init())
error("Couldn't init sound");
diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h
index e7cc92c5e1..5d20cb0652 100644
--- a/engines/kyra/kyra_lok.h
+++ b/engines/kyra/kyra_lok.h
@@ -507,6 +507,9 @@ protected:
static const int8 _dosTrackMap[];
static const int _dosTrackMapSize;
+ static const int8 _amigaTrackMap[];
+ static const int _amigaTrackMapSize;
+
// TODO: get rid of all variables having pointers to the static resources if possible
// i.e. let them directly use the _staticres functions
void initStaticResource();
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index d8e91b138d..cf2b360d79 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -50,7 +50,10 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
_emc = 0;
_debugger = 0;
- _gameSpeed = 60;
+ if (_flags.platform == Common::kPlatformAmiga)
+ _gameSpeed = 50;
+ else
+ _gameSpeed = 60;
_tickLength = (uint8)(1000.0 / _gameSpeed);
_trackMap = 0;
@@ -114,6 +117,8 @@ Common::Error KyraEngine_v1::init() {
_sound = new SoundPC98(this, _mixer);
else
_sound = new SoundTownsPC98_v2(this, _mixer);
+ } else if (_flags.platform == Common::kPlatformAmiga) {
+ _sound = new SoundAmiga(this, _mixer);
} else if (midiDriver == MD_ADLIB) {
_sound = new SoundAdlibPC(this, _mixer);
} else {
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk
index 7b0c0dfb68..b484fa345f 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -50,6 +50,7 @@ MODULE_OBJS := \
sequences_hof.o \
sequences_mr.o \
sound_adlib.o \
+ sound_amiga.o \
sound_digital.o \
sound_midi.o \
sound_pcspk.o \
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index 38d1b90e7a..4086d06c00 100644
--- a/engines/kyra/seqplayer.cpp
+++ b/engines/kyra/seqplayer.cpp
@@ -414,8 +414,6 @@ void SeqPlayer::s1_fillRect() {
void SeqPlayer::s1_playEffect() {
uint8 track = *_seqData++;
- if (_vm->gameFlags().platform == Common::kPlatformAmiga)
- return;
_vm->delay(3 * _vm->tickLength());
_sound->playSoundEffect(track);
}
@@ -423,9 +421,6 @@ void SeqPlayer::s1_playEffect() {
void SeqPlayer::s1_playTrack() {
uint8 msg = *_seqData++;
- if (_vm->gameFlags().platform == Common::kPlatformAmiga)
- return;
-
if (msg == 1) {
_sound->beginFadeOut();
} else {
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index d13dc2d291..16c9b75f3a 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -110,7 +110,7 @@ void KyraEngine_LoK::seq_intro() {
_seq->setCopyViewOffs(true);
_screen->setFont(Screen::FID_8_FNT);
- if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98)
+ if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98 && _flags.platform != Common::kPlatformAmiga)
snd_playTheme(0, 2);
_text->setTalkCoords(144);
@@ -994,6 +994,14 @@ int KyraEngine_LoK::seq_playEnd() {
snd_playWanderScoreViaMap(50, 1);
setupPanPages();
+ if (_flags.platform == Common::kPlatformAmiga) {
+ _sound->loadSoundFile(kMusicFinale);
+
+ // The original started song 0 directly here. Since our player
+ // uses 0, 1 for stop and fade we start song 0 with 2
+ _sound->playTrack(2);
+ }
+
_finalA = createWSAMovie();
assert(_finalA);
_finalA->open("finala.wsa", 1, 0);
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 91945d91ee..781516282e 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -215,6 +215,13 @@ void KyraEngine_v1::snd_playWanderScoreViaMap(int command, int restart) {
_sound->playTrack(command);
}
}
+ } else if (_flags.platform == Common::kPlatformAmiga) {
+ if (_curMusicTheme != 1)
+ snd_playTheme(1, -1);
+
+ assert(command < _trackMapSize);
+ if (_trackMap[_lastMusicCommand] != _trackMap[command])
+ _sound->playTrack(_trackMap[command]);
}
_lastMusicCommand = command;
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index 263cd586f7..2f24a264f1 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -55,7 +55,8 @@ public:
kMidiGM,
kTowns,
kPC98,
- kPCSpkr
+ kPCSpkr,
+ kAmiga
};
virtual kType getMusicType() const = 0;
diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp
new file mode 100644
index 0000000000..0b64e67525
--- /dev/null
+++ b/engines/kyra/sound_amiga.cpp
@@ -0,0 +1,239 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/system.h"
+#include "common/mutex.h"
+#include "kyra/resource.h"
+#include "kyra/sound_intern.h"
+
+#include "sound/mixer.h"
+#include "sound/mods/maxtrax.h"
+#include "sound/audiostream.h"
+
+namespace {
+
+FORCEINLINE uint8 sfxTableGetNote(const byte* address) {
+ return (uint8)address[0];
+}
+FORCEINLINE uint8 sfxTableGetPatch(const byte* address) {
+ return (uint8)address[1];
+}
+FORCEINLINE uint16 sfxTableGetDuration(const byte* address) {
+ return READ_BE_UINT16(&address[4]);
+}
+FORCEINLINE int8 sfxTableGetVolume(const byte* address) {
+ return (int8)address[6];
+}
+FORCEINLINE int8 sfxTableGetPan(const byte* address) {
+ return (int8)address[7];
+}
+
+} // end of namespace
+
+namespace Kyra {
+
+SoundAmiga::SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer)
+ : Sound(vm, mixer),
+ _driver(0),
+ _musicHandle(),
+ _fileLoaded(kFileNone),
+ _tableSfxIntro(),
+ _tableSfxGame() {
+}
+
+SoundAmiga::~SoundAmiga() {
+ _mixer->stopHandle(_musicHandle);
+ delete _driver;
+}
+
+extern const byte LoKAmigaSfxIntro[];
+extern const byte LoKAmigaSfxGame[];
+
+bool SoundAmiga::init() {
+ _driver = new Audio::MaxTrax(_mixer->getOutputRate(), true);
+ _tableSfxIntro = LoKAmigaSfxIntro;
+ _tableSfxGame = LoKAmigaSfxGame;
+
+ return _driver != 0 && _tableSfxIntro && _tableSfxGame;
+}
+
+void SoundAmiga::loadSoundFile(uint file) {
+ debugC(5, kDebugLevelSound, "SoundAmiga::loadSoundFile(%d)", file);
+
+ static const char *const tableFilenames[3][2] = {
+ { "introscr.mx", "introinst.mx" },
+ { "kyramusic.mx", 0 },
+ { "finalescr.mx", "introinst.mx" }
+ };
+ assert(file < ARRAYSIZE(tableFilenames));
+ if (_fileLoaded == (FileType)file)
+ return;
+ const char* scoreName = tableFilenames[file][0];
+ const char* sampleName = tableFilenames[file][1];
+ bool loaded = false;
+
+ Common::SeekableReadStream *scoreIn = _vm->resource()->createReadStream(scoreName);
+ if (sampleName) {
+ Common::SeekableReadStream *sampleIn = _vm->resource()->createReadStream(sampleName);
+ if (scoreIn && sampleIn) {
+ _fileLoaded = kFileNone;
+ loaded = _driver->load(*scoreIn, true, false);
+ loaded = loaded && _driver->load(*sampleIn, false, true);
+ } else
+ warning("SoundAmiga: missing atleast one of those music files: %s, %s", scoreName, sampleName);
+ delete sampleIn;
+ } else {
+ if (scoreIn) {
+ _fileLoaded = kFileNone;
+ loaded = _driver->load(*scoreIn);
+ } else
+ warning("SoundAmiga: missing music file: %s", scoreName);
+ }
+ delete scoreIn;
+
+ if (loaded)
+ _fileLoaded = (FileType)file;
+}
+
+void SoundAmiga::playTrack(uint8 track) {
+ debugC(5, kDebugLevelSound, "SoundAmiga::playTrack(%d)", track);
+
+ static const byte tempoIntro[] = { 0x46, 0x55, 0x3C, 0x41 };
+ static const byte tempoFinal[] = { 0x78, 0x50 };
+ static const byte tempoIngame[] = {
+ 0x64, 0x64, 0x64, 0x64, 0x64, 0x73, 0x4B, 0x64,
+ 0x64, 0x64, 0x55, 0x9C, 0x6E, 0x91, 0x78, 0x84,
+ 0x32, 0x64, 0x64, 0x6E, 0x3C, 0xD8, 0xAF
+ };
+ static const byte loopIngame[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00
+ };
+
+ int score = -1;
+ bool loop = false;
+ byte volume = 0x40;
+ byte tempo = 0;
+
+
+ switch (_fileLoaded) {
+ case kFileIntro:
+ if (track >= 2 && track < ARRAYSIZE(tempoIntro) + 2) {
+ score = track - 2;
+ tempo = tempoIntro[score];
+ }
+ break;
+
+ case kFileGame:
+ if (track >= 11 && track < ARRAYSIZE(tempoIngame) + 11) {
+ score = track - 11;
+ loop = loopIngame[score] != 0;
+ tempo = tempoIngame[score];
+ }
+ break;
+
+ case kFileFinal:
+ // score 0 gets started immediately after loading the music-files with different tempo.
+ // we need to define a track-value for the fake call of this function
+ if (track >= 2 && track < ARRAYSIZE(tempoFinal) + 2) {
+ score = track - 2;
+ loop = true;
+ tempo = tempoFinal[score];
+ }
+ break;
+
+ default:
+ return;
+ }
+
+ if (score >= 0) {
+ if (_musicEnabled && _driver->playSong(score, loop)) {
+ _driver->setVolume(volume);
+ _driver->setTempo(tempo << 4);
+ if (!_mixer->isSoundHandleActive(_musicHandle))
+ _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_musicHandle, _driver, -1, Audio::Mixer::kMaxChannelVolume, 0, false);
+ }
+ } else if (track == 0)
+ _driver->stopMusic();
+ else if (track == 1)
+ beginFadeOut();
+}
+
+void SoundAmiga::haltTrack() {
+ debugC(5, kDebugLevelSound, "SoundAmiga::haltTrack()");
+ _driver->stopMusic();
+}
+
+void SoundAmiga::beginFadeOut() {
+ debugC(5, kDebugLevelSound, "SoundAmiga::beginFadeOut()");
+ for (int i = 0x3F; i >= 0; --i) {
+ _driver->setVolume((byte)i);
+ _vm->delay(_vm->tickLength());
+ }
+
+ _driver->stopMusic();
+ _vm->delay(_vm->tickLength());
+ _driver->setVolume(0x40);
+}
+
+void SoundAmiga::playSoundEffect(uint8 track) {
+ debugC(5, kDebugLevelSound, "SoundAmiga::playSoundEffect(%d)", track);
+ const byte* tableEntry = 0;
+ bool pan = false;
+
+ switch (_fileLoaded) {
+ case kFileFinal:
+ case kFileIntro:
+ // We only allow playing of sound effects, which are included in the table.
+ if (track < 40) {
+ tableEntry = &_tableSfxIntro[track * 8];
+ pan = (sfxTableGetPan(tableEntry) != 0);
+ }
+ break;
+
+ case kFileGame:
+ if (0x61 <= track && track <= 0x63)
+ playTrack(track - 0x4F);
+
+ assert(track < 120);
+ if (sfxTableGetNote(&_tableSfxGame[track * 8])) {
+ tableEntry = &_tableSfxGame[track * 8];
+ pan = (sfxTableGetPan(tableEntry) != 0) && (sfxTableGetPan(tableEntry) != 2);
+ }
+ break;
+ default:
+ ;
+ }
+
+ if (_sfxEnabled && tableEntry) {
+ const bool success = _driver->playNote(sfxTableGetNote(tableEntry), sfxTableGetPatch(tableEntry), sfxTableGetDuration(tableEntry), sfxTableGetVolume(tableEntry), pan);
+ if (success && !_mixer->isSoundHandleActive(_musicHandle))
+ _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_musicHandle, _driver, -1, Audio::Mixer::kMaxChannelVolume, 0, false);
+ }
+}
+
+} // end of namespace Kyra
+
diff --git a/engines/kyra/sound_intern.h b/engines/kyra/sound_intern.h
index 975672b76a..b85b8a2e30 100644
--- a/engines/kyra/sound_intern.h
+++ b/engines/kyra/sound_intern.h
@@ -37,6 +37,7 @@
namespace Audio {
class PCSpeaker;
+class MaxTrax;
} // end of namespace Audio
namespace Kyra {
@@ -284,7 +285,34 @@ private:
static const uint8 _noteTable2[];
};
+class SoundAmiga : public Sound {
+public:
+ SoundAmiga(KyraEngine_v1 *vm, Audio::Mixer *mixer);
+ ~SoundAmiga();
+
+ virtual kType getMusicType() const { return kAmiga; } //FIXME
+
+ bool init();
+
+ void process() {}
+ void loadSoundFile(uint file);
+ void loadSoundFile(Common::String) {}
+
+ void playTrack(uint8 track);
+ void haltTrack();
+ void beginFadeOut();
+
+ int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, bool isSfx) { return -1; }
+ void playSoundEffect(uint8);
+
+protected:
+ Audio::MaxTrax *_driver;
+ Audio::SoundHandle _musicHandle;
+ enum FileType { kFileNone = -1, kFileIntro = 0, kFileGame = 1, kFileFinal = 2 } _fileLoaded;
+ const byte *_tableSfxIntro;
+ const byte *_tableSfxGame;
+};
+
} // end of namespace Kyra
#endif
-
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 4f3824479d..be73df47f7 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -2356,6 +2356,18 @@ const int8 KyraEngine_LoK::_dosTrackMap[] = {
const int KyraEngine_LoK::_dosTrackMapSize = ARRAYSIZE(KyraEngine_LoK::_dosTrackMap);
+const int8 KyraEngine_LoK::_amigaTrackMap[] = {
+ 0, 1, 32, 26, 31, 30, 33, 33,
+ 32, 17, 27, 32, 25, 29, 25, 24,
+ 23, 26, 26, 30, 28, 21, 21, 15,
+ 3, 15, 23, 25, 33, 21, 30, 22,
+ 15, 3, 33, 11, 12, 13, 14, 22,
+ 22, 22, 3, 3, 3, 23, 3, 3,
+ 23, 3, 3, 3, 3, 3, 3, 33
+};
+
+const int KyraEngine_LoK::_amigaTrackMapSize = ARRAYSIZE(KyraEngine_LoK::_amigaTrackMap);
+
// kyra engine v2 static data
const int GUI_v2::_sliderBarsPosition[] = {
@@ -3378,4 +3390,172 @@ const int LoLEngine::_outroMonsterScaleTableY[] = {
#endif // ENABLE_LOL
+// TODO: fileoffset = 0x32D5C, len = 40 * 8
+extern const byte LoKAmigaSfxIntro[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00,
+ 0x3C, 0x13, 0x00, 0x00, 0x1B, 0x91, 0x6E, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x16, 0x00, 0x00, 0x26, 0x77, 0x6E, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x17, 0x00, 0x00, 0x11, 0x98, 0x6E, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00,
+ 0x3C, 0x18, 0x00, 0x00, 0x22, 0xD1, 0x6E, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x6E, 0x00,
+ 0x45, 0x03, 0x00, 0x00, 0x02, 0x24, 0x6E, 0x00,
+ 0x3C, 0x16, 0x00, 0x00, 0x26, 0x77, 0x6E, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+// TODO: fileoffset = 0x2C55E, len = 120 * 8
+extern const byte LoKAmigaSfxGame[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02,
+ 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02,
+ 0x3C, 0x15, 0x00, 0x00, 0x1B, 0x91, 0x78, 0x02,
+ 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02,
+ 0x3C, 0x17, 0x00, 0x00, 0x12, 0x2B, 0x78, 0x02,
+ 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02,
+ 0x45, 0x03, 0x00, 0x00, 0x02, 0x24, 0x78, 0x02,
+ 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x2C, 0x04, 0x00, 0x00, 0x09, 0x10, 0x78, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x3C, 0x1A, 0x00, 0x00, 0x3A, 0xEB, 0x78, 0x02,
+ 0x25, 0x1B, 0x00, 0x00, 0x13, 0x8B, 0x78, 0x02,
+ 0x18, 0x03, 0x00, 0x00, 0x0F, 0x52, 0x78, 0x02,
+ 0x3E, 0x1C, 0x00, 0x00, 0x06, 0x22, 0x78, 0x02,
+ 0x3B, 0x1C, 0x00, 0x00, 0x07, 0x54, 0x78, 0x02,
+ 0x16, 0x03, 0x00, 0x00, 0x20, 0x6F, 0x78, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x3C, 0x1D, 0x00, 0x00, 0x09, 0xEA, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02,
+ 0x3C, 0x1E, 0x00, 0x00, 0x03, 0x6E, 0x78, 0x02,
+ 0x3C, 0x17, 0x00, 0x00, 0x12, 0x2B, 0x78, 0x02,
+ 0x4E, 0x0B, 0x00, 0x00, 0x09, 0x91, 0x78, 0x02,
+ 0x47, 0x1B, 0x00, 0x00, 0x02, 0xBC, 0x78, 0x02,
+ 0x4C, 0x1B, 0x00, 0x00, 0x02, 0x11, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02,
+ 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02,
+ 0x3C, 0x1F, 0x00, 0x00, 0x0E, 0x9E, 0x78, 0x02,
+ 0x3C, 0x20, 0x00, 0x00, 0x01, 0x0C, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x3C, 0x21, 0x00, 0x00, 0x0F, 0x7C, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x2A, 0x0B, 0x00, 0x00, 0x4C, 0x47, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x1B, 0x00, 0x00, 0x05, 0x28, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x2C, 0x04, 0x00, 0x00, 0x09, 0x10, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x22, 0x00, 0x00, 0x0A, 0xEE, 0x78, 0x02,
+ 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02,
+ 0x3C, 0x15, 0x00, 0x00, 0x1B, 0x91, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x22, 0x00, 0x00, 0x0A, 0xEE, 0x78, 0x02,
+ 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02,
+ 0x32, 0x23, 0x00, 0x00, 0x14, 0x19, 0x9C, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x17, 0x1C, 0x78, 0x02,
+ 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02,
+ 0x3E, 0x1C, 0x00, 0x00, 0x06, 0x22, 0x78, 0x02,
+ 0x43, 0x13, 0x00, 0x00, 0x02, 0x01, 0x78, 0x02,
+ 0x3C, 0x24, 0x00, 0x00, 0x12, 0x43, 0x5A, 0x02,
+ 0x3E, 0x20, 0x00, 0x00, 0x00, 0xEE, 0x78, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x29, 0x04, 0x00, 0x00, 0x19, 0xEA, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x20, 0x00, 0x00, 0x01, 0x0C, 0x78, 0x02,
+ 0x3C, 0x25, 0x00, 0x00, 0x30, 0xB6, 0x78, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x16, 0x00, 0x00, 0x1E, 0x97, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x1A, 0x00, 0x00, 0x3A, 0xEB, 0x78, 0x02,
+ 0x1B, 0x04, 0x00, 0x00, 0x39, 0xF3, 0x78, 0x02,
+ 0x30, 0x23, 0x00, 0x00, 0x16, 0x99, 0x50, 0x02,
+ 0x3C, 0x15, 0x00, 0x00, 0x1B, 0x91, 0x78, 0x02,
+ 0x29, 0x06, 0x00, 0x00, 0x19, 0xEA, 0x50, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x1A, 0x00, 0x00, 0x3A, 0xEB, 0x78, 0x02,
+ 0x3C, 0x19, 0x00, 0x00, 0x25, 0x2C, 0x78, 0x02,
+ 0x3C, 0x26, 0x00, 0x00, 0x07, 0x13, 0x78, 0x02,
+ 0x3C, 0x26, 0x00, 0x00, 0x07, 0x13, 0x78, 0x02,
+ 0x3C, 0x14, 0x00, 0x00, 0x27, 0x2C, 0x78, 0x02,
+ 0x30, 0x23, 0x00, 0x00, 0x16, 0x99, 0x50, 0x02,
+ 0x30, 0x23, 0x00, 0x00, 0x16, 0x99, 0x50, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3C, 0x13, 0x00, 0x00, 0x01, 0x56, 0x78, 0x02
+};
+
} // End of namespace Kyra
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index 58d8db91fc..51fbecdb0d 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -40,6 +40,7 @@ MODULE_OBJS := \
player_v2a.o \
player_v2cms.o \
player_v3a.o \
+ player_v4a.o \
resource_v2.o \
resource_v3.o \
resource_v4.o \
diff --git a/engines/scumm/music.h b/engines/scumm/music.h
index c6555318a9..2fd7c50bce 100644
--- a/engines/scumm/music.h
+++ b/engines/scumm/music.h
@@ -81,12 +81,6 @@ public:
* @return the music timer
*/
virtual int getMusicTimer() const { return 0; }
-
- /**
- * Terminate the music engine. Called just before the music engine
- * is deleted.
- */
- virtual void terminate() {}
};
} // End of namespace Scumm
diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp
new file mode 100644
index 0000000000..f441b3b364
--- /dev/null
+++ b/engines/scumm/player_v4a.cpp
@@ -0,0 +1,193 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "engines/engine.h"
+#include "scumm/player_v4a.h"
+#include "scumm/scumm.h"
+
+#include "common/file.h"
+
+namespace Scumm {
+
+Player_V4A::Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer)
+ : _vm(scumm),
+ _mixer(mixer),
+ _tfmxMusic(_mixer->getOutputRate(), true),
+ _tfmxSfx(_mixer->getOutputRate(), true),
+ _musicHandle(),
+ _sfxHandle(),
+ _musicId(),
+ _sfxSlots(),
+ _initState(0),
+ _signal(0) {
+
+ assert(scumm);
+ assert(mixer);
+ assert(_vm->_game.id == GID_MONKEY_VGA);
+ _tfmxMusic.setSignalPtr(&_signal, 1);
+}
+
+bool Player_V4A::init() {
+ if (_vm->_game.id != GID_MONKEY_VGA)
+ error("player_v4a - unknown game");
+
+ Common::File fileMdat, fileSample;
+
+ if (fileMdat.open("music.dat") && fileSample.open("sample.dat")) {
+ // explicitly request that no instance delets the resources automatically
+ if (_tfmxMusic.load(fileMdat, fileSample, false)) {
+ _tfmxSfx.setModuleData(_tfmxMusic);
+ return true;
+ }
+ } else
+ warning("player_v4a: couldnt load one of the music resources: music.dat, sample.dat");
+
+ return false;
+}
+
+Player_V4A::~Player_V4A() {
+ _mixer->stopHandle(_musicHandle);
+ _mixer->stopHandle(_sfxHandle);
+ _tfmxMusic.freeResources();
+}
+
+void Player_V4A::setMusicVolume(int vol) {
+ debug(5, "player_v4a: setMusicVolume %i", vol);
+}
+
+void Player_V4A::stopAllSounds() {
+ debug(5, "player_v4a: stopAllSounds");
+ if (_initState > 0) {
+ _tfmxMusic.stopSong();
+ _signal = 0;
+ _musicId = 0;
+
+ _tfmxSfx.stopSong();
+ clearSfxSlots();
+ } else
+ _mixer->stopHandle(_musicHandle);
+}
+
+void Player_V4A::stopSound(int nr) {
+ debug(5, "player_v4a: stopSound %d", nr);
+ if (nr == 0)
+ return;
+ if (nr == _musicId) {
+ _musicId = 0;
+ if (_initState > 0)
+ _tfmxMusic.stopSong();
+ else
+ _mixer->stopHandle(_musicHandle);
+ _signal = 0;
+ } else {
+ const int chan = getSfxChan(nr);
+ if (chan != -1) {
+ setSfxSlot(chan, 0);
+ _tfmxSfx.stopMacroEffect(chan);
+ }
+ }
+}
+
+void Player_V4A::startSound(int nr) {
+ static const int8 monkeyCommands[52] = {
+ -1, -2, -3, -4, -5, -6, -7, -8,
+ -9, -10, -11, -12, -13, -14, 18, 17,
+ -17, -18, -19, -20, -21, -22, -23, -24,
+ -25, -26, -27, -28, -29, -30, -31, -32,
+ -33, 16, -35, 0, 1, 2, 3, 7,
+ 8, 10, 11, 4, 5, 14, 15, 12,
+ 6, 13, 9, 19
+ };
+
+ const byte *ptr = _vm->getResourceAddress(rtSound, nr);
+ assert(ptr);
+
+ const int val = ptr[9];
+ if (val < 0 || val >= ARRAYSIZE(monkeyCommands)) {
+ warning("player_v4a: illegal Songnumber %i", val);
+ return;
+ }
+
+ if (!_initState)
+ _initState = init() ? 1 : -1;
+
+ if (_initState < 0)
+ return;
+
+ int index = monkeyCommands[val];
+ const byte type = ptr[6];
+ if (index < 0) { // SoundFX
+ index = -index - 1;
+ debug(3, "player_v4a: play %d: custom %i - %02X", nr, index, type);
+
+ // start an empty Song so timing is setup
+ if (_tfmxSfx.getSongIndex() < 0)
+ _tfmxSfx.doSong(0x18);
+
+ const int chan = _tfmxSfx.doSfx((uint16)index);
+ if (chan >= 0 && chan < ARRAYSIZE(_sfxSlots))
+ setSfxSlot(chan, nr, type);
+ else
+ warning("player_v4a: custom %i is not of required type", index);
+
+ // the Tfmx-player never "ends" the output by itself, so this should be threadsafe
+ if (!_mixer->isSoundHandleActive(_sfxHandle))
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, &_tfmxSfx, -1, Audio::Mixer::kMaxChannelVolume, 0, false);
+
+ } else { // Song
+ debug(3, "player_v4a: play %d: song %i - %02X", nr, index, type);
+ if (ptr[6] != 0x7F)
+ warning("player_v4a: Song has wrong type");
+
+ _tfmxMusic.doSong(index);
+ _signal = 2;
+
+ // the Tfmx-player never "ends" the output by itself, so this should be threadsafe
+ if (!_mixer->isSoundHandleActive(_musicHandle))
+ _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, &_tfmxMusic, -1, Audio::Mixer::kMaxChannelVolume, 0, false);
+ _musicId = nr;
+ }
+}
+
+int Player_V4A::getMusicTimer() const {
+ // A workaround if the modplayer couldnt load the datafiles - just return a number big enough to pass all tests
+ if (_initState < 0)
+ return 2000;
+ if (_musicId) {
+ // The titlesong (and a few others) is running with ~70 ticks per second and the scale seems to be based on that.
+ // The Game itself doesnt get the timing from the Tfmx Player however, so we just use the elapsed time
+ // 357 ~ 1000 * 25 * (1 / 70)
+ return _mixer->getSoundElapsedTime(_musicHandle) / 357;
+ }
+ return 0;
+}
+
+int Player_V4A::getSoundStatus(int nr) const {
+ // For music the game queues a variable the Tfmx Player sets through a special command.
+ // For sfx there seems to be no way to queue them, and the game doesnt try to.
+ return (nr == _musicId) ? _signal : 0;
+}
+
+} // End of namespace Scumm
diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h
new file mode 100644
index 0000000000..5f5fae6b56
--- /dev/null
+++ b/engines/scumm/player_v4a.h
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCUMM_PLAYER_V4A_H
+#define SCUMM_PLAYER_V4A_H
+
+#include "common/scummsys.h"
+#include "scumm/music.h"
+#include "sound/mixer.h"
+#include "sound/mods/tfmx.h"
+
+class Mixer;
+
+namespace Scumm {
+
+class ScummEngine;
+
+/**
+ * Scumm V4 Amiga sound/music driver.
+ */
+class Player_V4A : public MusicEngine {
+public:
+ Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer);
+ virtual ~Player_V4A();
+
+ virtual void setMusicVolume(int vol);
+ virtual void startSound(int sound);
+ virtual void stopSound(int sound);
+ virtual void stopAllSounds();
+ virtual int getMusicTimer() const;
+ virtual int getSoundStatus(int sound) const;
+
+private:
+ ScummEngine *const _vm;
+ Audio::Mixer *const _mixer;
+
+ Audio::Tfmx _tfmxMusic;
+ Audio::Tfmx _tfmxSfx;
+ Audio::SoundHandle _musicHandle;
+ Audio::SoundHandle _sfxHandle;
+
+ int _musicId;
+ uint16 _signal;
+
+ struct SfxChan {
+ int id;
+// byte type;
+ } _sfxSlots[4];
+
+ int8 _initState; // < 0: failed, 0: uninitialised, > 0: initialised
+
+ int getSfxChan(int id) const {
+ for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i)
+ if (_sfxSlots[i].id == id)
+ return i;
+ return -1;
+ }
+
+ void setSfxSlot(int channel, int id, byte type = 0) {
+ _sfxSlots[channel].id = id;
+// _sfxSlots[channel].type = type;
+ }
+
+ void clearSfxSlots() {
+ for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i){
+ _sfxSlots[i].id = 0;
+// _sfxSlots[i].type = 0;
+ }
+ }
+
+ bool init();
+};
+
+} // End of namespace Scumm
+
+#endif
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index af6b9278c6..587e2a8abe 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -56,6 +56,7 @@
#include "scumm/player_v2.h"
#include "scumm/player_v2a.h"
#include "scumm/player_v3a.h"
+#include "scumm/player_v4a.h"
#include "scumm/he/resource_he.h"
#include "scumm/scumm_v0.h"
#include "scumm/scumm_v8.h"
@@ -284,7 +285,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_useTalkAnims = false;
_defaultTalkDelay = 0;
_musicType = MDT_NONE;
- _tempMusic = 0;
_saveSound = 0;
memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
memset(_scaleSlots, 0, sizeof(_scaleSlots));
@@ -554,10 +554,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
ScummEngine::~ScummEngine() {
Common::clearAllDebugChannels();
- if (_musicEngine) {
- _musicEngine->terminate();
- delete _musicEngine;
- }
+ delete _musicEngine;
_mixer->stopAll();
@@ -1296,7 +1293,6 @@ void ScummEngine::setupCostumeRenderer() {
void ScummEngine::resetScumm() {
int i;
- _tempMusic = 0;
debug(9, "resetScumm");
if (_game.version == 0) {
@@ -1698,7 +1694,7 @@ void ScummEngine::setupMusic(int midi) {
} else if (_game.platform == Common::kPlatformPCEngine && _game.version == 3) {
// TODO: Add support for music format
} else if (_game.platform == Common::kPlatformAmiga && _game.version <= 4) {
- // TODO: Add support for music format
+ _musicEngine = new Player_V4A(this, _mixer);
} else if (_game.id == GID_MANIAC && _game.version == 1) {
_musicEngine = new Player_V1(this, _mixer, midiDriver != MD_PCSPK);
} else if (_game.version <= 2) {
@@ -1909,17 +1905,6 @@ void ScummEngine::scummLoop(int delta) {
if (_musicEngine) {
// The music engine generates the timer data for us.
VAR(VAR_MUSIC_TIMER) = _musicEngine->getMusicTimer();
- } else {
- // Used for Money Island 1 (Amiga)
- // TODO: The music delay (given in milliseconds) might have to be tuned a little
- // to get it correct for all games. Without the ability to watch/listen to the
- // original games, I can't do that myself.
- const int MUSIC_DELAY = 350;
- _tempMusic += delta * 1000 / 60; // Convert delta to milliseconds
- if (_tempMusic >= MUSIC_DELAY) {
- _tempMusic -= MUSIC_DELAY;
- VAR(VAR_MUSIC_TIMER) += 1;
- }
}
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 6866b17668..940ea512d5 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1139,7 +1139,6 @@ protected:
bool _haveActorSpeechMsg;
bool _useTalkAnims;
uint16 _defaultTalkDelay;
- int _tempMusic;
int _saveSound;
bool _native_mt32;
bool _enable_gs;
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 524dbf70ea..82ed2a62e6 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -436,26 +436,6 @@ void Sound::playSound(int soundID) {
if (_vm->_game.id == GID_MONKEY_VGA || _vm->_game.id == GID_MONKEY_EGA
|| (_vm->_game.id == GID_MONKEY && _vm->_game.platform == Common::kPlatformMacintosh)) {
- // Sound is currently not supported at all in the amiga versions of these games
- if (_vm->_game.platform == Common::kPlatformAmiga) {
- int track = -1;
- if (soundID == 50)
- track = 17;
- else if (ptr[6] == 0x7F && ptr[7] == 0x00 && ptr[8] == 0x80) {
- static const char tracks[16] = {13,14,10,3,4,9,16,5,1,8,2,15,6,7,11,12};
- if (ptr[9] == 0x0E)
- track = 18;
- else
- track = tracks[ptr[9] - 0x23];
- }
- if (track != -1) {
- playCDTrack(track,((track < 5) || (track > 16)) ? 1 : -1,0,0);
- stopCDTimer();
- _currentCDSound = soundID;
- }
- return;
- }
-
// Works around the fact that in some places in MonkeyEGA/VGA,
// the music is never explicitly stopped.
// Rather it seems that starting a new music is supposed to