diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 5073ceae7eb..1fd3428c206 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -26,23 +26,19 @@ #include "backends/mutex/mutex.h" #include "gui/EventRecorder.h" -#include "audio/mixer.h" #include "common/timer.h" #include "graphics/pixelformat.h" ModularBackend::ModularBackend() : _mutexManager(0), - _graphicsManager(0), - _mixer(0) { + _graphicsManager(0) { } ModularBackend::~ModularBackend() { delete _graphicsManager; _graphicsManager = 0; - delete _mixer; - _mixer = 0; // _timerManager needs to be deleted before _mutexManager to avoid a crash. delete _timerManager; _timerManager = 0; @@ -271,11 +267,6 @@ void ModularBackend::deleteMutex(MutexRef mutex) { _mutexManager->deleteMutex(mutex); } -Audio::Mixer *ModularBackend::getMixer() { - assert(_mixer); - return (Audio::Mixer *)_mixer; -} - void ModularBackend::displayMessageOnOSD(const char *msg) { _graphicsManager->displayMessageOnOSD(msg); } diff --git a/backends/modular-backend.h b/backends/modular-backend.h index ca4356de52d..e57dbf174f5 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -40,6 +40,7 @@ class MutexManager; * OSystem::getMillis() * OSystem::delayMillis() * OSystem::getTimeAndDate() + * OSystem::getMixer() * OSystem::quit() * * And, it should also initialize all the managers variables @@ -125,13 +126,6 @@ public: //@} - /** @name Sound */ - //@{ - - virtual Audio::Mixer *getMixer() override; - - //@} - /** @name Miscellaneous */ //@{ @@ -146,7 +140,6 @@ protected: MutexManager *_mutexManager; GraphicsManager *_graphicsManager; - Audio::Mixer *_mixer; //@} }; diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 2da3266e991..636ad5004bf 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -79,17 +79,21 @@ public: virtual void delayMillis(uint msecs); virtual void getTimeAndDate(TimeDate &t) const; + virtual Audio::Mixer *getMixer(); + virtual void quit(); virtual void logMessage(LogMessageType::Type type, const char *message); -#ifdef POSIX private: + Audio::MixerImpl *_mixer; + +#ifdef POSIX timeval _startTime; #endif }; -OSystem_NULL::OSystem_NULL() { +OSystem_NULL::OSystem_NULL() : _mixer(0) { #if defined(__amigaos4__) _fsFactory = new AmigaOSFilesystemFactory(); #elif defined(__MORPHOS__) @@ -106,6 +110,8 @@ OSystem_NULL::OSystem_NULL() { } OSystem_NULL::~OSystem_NULL() { + delete _mixer; + _mixer = 0; } #ifdef POSIX @@ -133,7 +139,7 @@ void OSystem_NULL::initBackend() { _graphicsManager = new NullGraphicsManager(); _mixer = new Audio::MixerImpl(22050); - ((Audio::MixerImpl *)_mixer)->setReady(false); + _mixer->setReady(false); // Note that the mixer is useless this way; it needs to be hooked // into the system somehow to be functional. Of course, can't do @@ -197,6 +203,11 @@ void OSystem_NULL::getTimeAndDate(TimeDate &td) const { td.tm_wday = t.tm_wday; } +Audio::Mixer *OSystem_NULL::getMixer() { + assert(_mixer); + return (Audio::Mixer *)_mixer; +} + void OSystem_NULL::quit() { exit(0); }