Skip to content

Commit

Permalink
MADS: Move OPL creation from the engine to SoundManager
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Oct 12, 2014
1 parent d02693c commit f978539
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
7 changes: 1 addition & 6 deletions engines/mads/mads.cpp
Expand Up @@ -55,7 +55,6 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
_resources = nullptr;
_sound = nullptr;
_audio = nullptr;
_opl = nullptr;
}

MADSEngine::~MADSEngine() {
Expand All @@ -71,7 +70,6 @@ MADSEngine::~MADSEngine() {
delete _audio;

_mixer->stopAll();
delete _opl;
}

void MADSEngine::initialize() {
Expand All @@ -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);
Expand All @@ -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);

Expand Down
1 change: 0 additions & 1 deletion engines/mads/mads.h
Expand Up @@ -99,7 +99,6 @@ class MADSEngine : public Engine {
ScreenSurface _screen;
SoundManager *_sound;
AudioPlayer *_audio;
FM_OPL *_opl;
bool _easyMouse;
bool _invObjectsAnimated;
bool _textWindowStill;
Expand Down
9 changes: 7 additions & 2 deletions engines/mads/sound.cpp
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion engines/mads/sound.h
Expand Up @@ -44,7 +44,7 @@ class SoundManager {
bool _newSoundsPaused;
Common::Queue<int> _queuedCommands;
public:
SoundManager(MADSEngine *vm, Audio::Mixer *mixer, FM_OPL *opl);
SoundManager(MADSEngine *vm, Audio::Mixer *mixer);
~SoundManager();

/**
Expand Down

0 comments on commit f978539

Please sign in to comment.