Add support for using soundtrack from the Simon the Sorcerer 1 - Music Enhancement Project.

svn-id: r25632
This commit is contained in:
Travis Howell 2007-02-16 13:55:01 +00:00
parent cfc3d0a8ed
commit e3594a6839
3 changed files with 48 additions and 25 deletions

View File

@ -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();

View File

@ -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)

View File

@ -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);
}
}
}