From f978539cbc82066a5cdedfefddb539b11e60369a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Oct 2014 16:54:40 -0400 Subject: MADS: Move OPL creation from the engine to SoundManager --- engines/mads/mads.cpp | 7 +------ engines/mads/mads.h | 1 - engines/mads/sound.cpp | 9 +++++++-- engines/mads/sound.h | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index d56994ab8e..52a0b40561 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -55,7 +55,6 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _resources = nullptr; _sound = nullptr; _audio = nullptr; - _opl = nullptr; } MADSEngine::~MADSEngine() { @@ -71,7 +70,6 @@ MADSEngine::~MADSEngine() { delete _audio; _mixer->stopAll(); - delete _opl; } void MADSEngine::initialize() { @@ -80,9 +78,6 @@ void MADSEngine::initialize() { DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); - _opl = OPL::Config::create(); - _opl->init(11025); - // Initial sub-system engine references MSurface::setVm(this); MSprite::setVm(this); @@ -96,7 +91,7 @@ void MADSEngine::initialize() { Font::init(this); _font = new Font(); _screen.init(); - _sound = new SoundManager(this, _mixer, _opl); + _sound = new SoundManager(this, _mixer); _audio = new AudioPlayer(_mixer, getGameID()); _game = Game::init(this); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 8fc2788c28..9a8f2152a1 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -99,7 +99,6 @@ public: ScreenSurface _screen; SoundManager *_sound; AudioPlayer *_audio; - FM_OPL *_opl; bool _easyMouse; bool _invObjectsAnimated; bool _textWindowStill; diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 12109895b5..9d0d9c8d20 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -29,18 +29,23 @@ namespace MADS { -SoundManager::SoundManager(MADSEngine *vm, Audio::Mixer *mixer, FM_OPL *opl) { +SoundManager::SoundManager(MADSEngine *vm, Audio::Mixer *mixer) { _vm = vm; _mixer = mixer; - _opl = opl; _driver = nullptr; _pollSoundEnabled = false; _soundPollFlag = false; _newSoundsPaused = false; + + _opl = OPL::Config::create(); + _opl->init(11025); } SoundManager::~SoundManager() { + _driver->stop(); + delete _driver; + delete _opl; } void SoundManager::init(int sectionNumber) { diff --git a/engines/mads/sound.h b/engines/mads/sound.h index b2af7e2346..72bb21a812 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -44,7 +44,7 @@ private: bool _newSoundsPaused; Common::Queue _queuedCommands; public: - SoundManager(MADSEngine *vm, Audio::Mixer *mixer, FM_OPL *opl); + SoundManager(MADSEngine *vm, Audio::Mixer *mixer); ~SoundManager(); /** -- cgit v1.2.3