diff options
author | Travis Howell | 2007-02-16 13:55:01 +0000 |
---|---|---|
committer | Travis Howell | 2007-02-16 13:55:01 +0000 |
commit | e3594a6839682e8157bd29af5da9c0a26ead764c (patch) | |
tree | f00f87af3888edd3387b42b5071f10b2754481b5 | |
parent | cfc3d0a8ed53091d264c552403b0473de3359c2d (diff) | |
download | scummvm-rg350-e3594a6839682e8157bd29af5da9c0a26ead764c.tar.gz scummvm-rg350-e3594a6839682e8157bd29af5da9c0a26ead764c.tar.bz2 scummvm-rg350-e3594a6839682e8157bd29af5da9c0a26ead764c.zip |
Add support for using soundtrack from the Simon the Sorcerer 1 - Music Enhancement Project.
svn-id: r25632
-rw-r--r-- | engines/agos/agos.h | 2 | ||||
-rw-r--r-- | engines/agos/event.cpp | 6 | ||||
-rw-r--r-- | engines/agos/res_snd.cpp | 65 |
3 files changed, 48 insertions, 25 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index d4c4a553bb..8776aad14c 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1397,6 +1397,8 @@ protected: void windowDrawChar(WindowBlock *window, uint x, uint y, byte chr); void loadMusic(uint music); + void loadModule(uint music); + void checkTimerCallback(); void delay(uint delay); void pause(); diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index 37a72db995..8ffd6390f9 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -31,6 +31,8 @@ #include "gui/about.h" +#include "sound/audiocd.h" + namespace AGOS { void AGOSEngine::addTimeEvent(uint timeout, uint subroutine_id) { @@ -302,6 +304,8 @@ void AGOSEngine::delay(uint amount) { uint32 cur = start; uint this_delay, vga_period; + AudioCD.updateCD(); + if (_debugger->isAttached()) _debugger->onFrame(); @@ -415,6 +419,8 @@ void AGOSEngine::delay(uint amount) { if (_leftButton == 1) _leftButtonCount++; + AudioCD.updateCD(); + _system->updateScreen(); if (amount == 0) diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 7fa8115d26..c9459c4005 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -30,6 +30,7 @@ #include "agos/agos.h" #include "agos/vga.h" +#include "sound/audiocd.h" #include "sound/audiostream.h" #include "sound/mididrv.h" #include "sound/mods/protracker.h" @@ -117,14 +118,7 @@ void AGOSEngine::skipSpeech() { } } -void AGOSEngine::loadMusic(uint music) { - char buf[4]; - - if (getGameId() == GID_SIMON1ACORN) { - // TODO: Add support for music format used by Simon 1 Floppy - } else if (getPlatform() == Common::kPlatformAtariST) { - // TODO: Add support for music format used by Elvira 2 - } else if (getPlatform() == Common::kPlatformAmiga) { +void AGOSEngine::loadModule(uint music) { _mixer->stopHandle(_modHandle); char filename[15]; @@ -163,7 +157,12 @@ void AGOSEngine::loadMusic(uint music) { } _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, audioStream); - } else if (getGameType() == GType_SIMON2) { +} + +void AGOSEngine::loadMusic(uint music) { + char buf[4]; + + if (getGameType() == GType_SIMON2) { midi.stop(); _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); _gameFile->read(buf, 4); @@ -179,16 +178,24 @@ void AGOSEngine::loadMusic(uint music) { _nextMusicToPlay = -1; } else if (getGameType() == GType_SIMON1) { midi.stop(); - midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.) - if (getFeatures() & GF_TALKIE) { + // Support for compressed music from the music enhancement project + AudioCD.stop(); + AudioCD.play(music, -1, 0, 0); + if (AudioCD.isPlaying()) + return; + + if (getGameId() == GID_SIMON1ACORN) { + // TODO: Add support for music format used by Simon 1 Floppy + } else if (getPlatform() == Common::kPlatformAmiga) { + loadModule(music); + } else if (getFeatures() & GF_TALKIE) { // FIXME: The very last music resource, a cymbal crash for when the // two demons crash into each other, should NOT be looped like the // other music tracks. In simon1dos/talkie the GMF resource includes // a loop override that acomplishes this, but there seems to be nothing // for this in the SMF resources. - if (music == 35) - midi.setLoop(false); + midi.setLoop(music != 35);; // Must do this BEFORE loading music. (GMF may have its own override.) _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET); _gameFile->read(buf, 4); @@ -200,6 +207,7 @@ void AGOSEngine::loadMusic(uint music) { midi.loadMultipleSMF(_gameFile); } + midi.startTrack(0); } else { char filename[15]; File f; @@ -208,26 +216,33 @@ void AGOSEngine::loadMusic(uint music) { if (f.isOpen() == false) error("loadMusic: Can't load music from '%s'", filename); + midi.setLoop(true); // Must do this BEFORE loading music. (GMF may have its own override.) if (getFeatures() & GF_DEMO) midi.loadS1D(&f); else midi.loadSMF(&f, music); - } - midi.startTrack(0); + midi.startTrack(0); + } } else { - midi.stop(); - midi.setLoop(true); // Must do this BEFORE loading music. + if (getPlatform() == Common::kPlatformAmiga) { + loadModule(music); + } else if (getPlatform() == Common::kPlatformAtariST) { + // TODO: Add support for music formats used + } else { + midi.stop(); + midi.setLoop(true); // Must do this BEFORE loading music. - char filename[15]; - File f; - sprintf(filename, "MOD%d.MUS", music); - f.open(filename); - if (f.isOpen() == false) - error("loadMusic: Can't load music from '%s'", filename); + char filename[15]; + File f; + sprintf(filename, "MOD%d.MUS", music); + f.open(filename); + if (f.isOpen() == false) + error("loadMusic: Can't load music from '%s'", filename); - midi.loadS1D(&f); - midi.startTrack(0); + midi.loadS1D(&f); + midi.startTrack(0); + } } } |