From 99d6e6db5ce2c0fcb8c3884d7b834ab6728daa66 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 23 Oct 2006 01:37:59 +0000 Subject: Add patch to make ProTracker a subclass of AudioStream, from madmoose svn-id: r24465 --- engines/agos/agos.cpp | 8 -------- engines/agos/agos.h | 2 +- engines/agos/res_snd.cpp | 13 ++++++++----- engines/agos/vga.cpp | 2 ++ 4 files changed, 11 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index d85819ba56..06035cd050 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -399,7 +399,6 @@ AGOSEngine::AGOSEngine(OSystem *syst) _vgaTickCounter = 0; - _modPlayer = 0; _moviePlay = 0; _sound = 0; @@ -526,12 +525,6 @@ int AGOSEngine::init() { _debugger = new Debugger(this); _sound = new Sound(this, gss, _mixer); - if (getPlatform() == Common::kPlatformAmiga) { - _modPlayer = new Modules::ProtrackerPlayer(); - _modPlayer->init(_system); - } else { - _modPlayer = 0; - } _moviePlay = new MoviePlayer(this, _mixer); if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) { @@ -778,7 +771,6 @@ AGOSEngine::~AGOSEngine() { delete [] _windowList; delete _debugger; - delete _modPlayer; delete _moviePlay; delete _sound; } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index cc5c695b90..6af12b7def 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -503,7 +503,7 @@ protected: int _vgaTickCounter; MoviePlayer *_moviePlay; - Modules::ProtrackerPlayer *_modPlayer; + Audio::SoundHandle _modHandle; Sound *_sound; diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 56d88351f0..f7b917b62c 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/audiostream.h" #include "sound/mididrv.h" #include "sound/mods/protracker.h" @@ -118,8 +119,7 @@ void AGOSEngine::loadMusic(uint music) { if (getPlatform() == Common::kPlatformAtariST) { // TODO: Add support for music format used by Elvira 2 } else if (getPlatform() == Common::kPlatformAmiga) { - assert(_modPlayer); - _modPlayer->stop(); + _mixer->stopHandle(_modHandle); char filename[15]; File f; @@ -134,8 +134,10 @@ void AGOSEngine::loadMusic(uint music) { error("loadMusic: Can't load module from '%s'", filename); } + Audio::AudioStream *audioStream; if (!(getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) && getFeatures() & GF_CRUNCHED) { + uint srcSize = f.size(); byte *srcBuf = (byte *)malloc(srcSize); if (f.read(srcBuf, srcSize) != srcSize) @@ -147,11 +149,12 @@ void AGOSEngine::loadMusic(uint music) { free(srcBuf); Common::MemoryReadStream stream(dstBuf, dstSize); - _modPlayer->loadModuleStream(stream); + audioStream = Audio::makeProtrackerStream(&stream, _mixer->getOutputRate()); } else { - _modPlayer->loadModuleStream(f); + audioStream = Audio::makeProtrackerStream(&f, _mixer->getOutputRate()); } - _modPlayer->start(); + + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, audioStream); } else if (getGameType() == GType_SIMON2) { midi.stop(); _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 04f1903a66..4a2d01014d 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1439,6 +1439,8 @@ void AGOSEngine::vc57_blackPalette() { void AGOSEngine::vc58_checkCodeWheel() { // TODO debug(0, "vc58_checkCodeWheel: stub"); + + _variableArray[0] = 1; } void AGOSEngine::vc59_skipIfNotEGA() { -- cgit v1.2.3