mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
BACKENDS: Move MixerManager code into ModularMixerBackend
This commit is contained in:
parent
d1bfa2c4ec
commit
b9d2b87085
@ -22,7 +22,9 @@
|
||||
|
||||
#include "backends/modular-backend.h"
|
||||
|
||||
#include "backends/audiocd/audiocd.h"
|
||||
#include "backends/graphics/graphics.h"
|
||||
#include "backends/mixer/mixer.h"
|
||||
#include "backends/mutex/mutex.h"
|
||||
#include "gui/EventRecorder.h"
|
||||
|
||||
@ -250,6 +252,31 @@ void ModularGraphicsBackend::displayActivityIconOnOSD(const Graphics::Surface *i
|
||||
}
|
||||
|
||||
|
||||
ModularMixerBackend::ModularMixerBackend()
|
||||
:
|
||||
_mixerManager(0) {
|
||||
|
||||
}
|
||||
|
||||
ModularMixerBackend::~ModularMixerBackend() {
|
||||
// _audiocdManager needs to be deleted before _mixerManager to avoid a crash.
|
||||
delete _audiocdManager;
|
||||
_audiocdManager = 0;
|
||||
delete _mixerManager;
|
||||
_mixerManager = 0;
|
||||
}
|
||||
|
||||
MixerManager *ModularMixerBackend::getMixerManager() {
|
||||
assert(_mixerManager);
|
||||
return _mixerManager;
|
||||
}
|
||||
|
||||
Audio::Mixer *ModularMixerBackend::getMixer() {
|
||||
assert(_mixerManager);
|
||||
return getMixerManager()->getMixer();
|
||||
}
|
||||
|
||||
|
||||
ModularMutexBackend::ModularMutexBackend()
|
||||
:
|
||||
_mutexManager(0) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "backends/base-backend.h"
|
||||
|
||||
class GraphicsManager;
|
||||
class MixerManager;
|
||||
class MutexManager;
|
||||
|
||||
/**
|
||||
@ -40,7 +41,6 @@ class MutexManager;
|
||||
* OSystem::getMillis()
|
||||
* OSystem::delayMillis()
|
||||
* OSystem::getTimeAndDate()
|
||||
* OSystem::getMixer()
|
||||
* OSystem::quit()
|
||||
*
|
||||
* And, it should also initialize all the managers variables
|
||||
@ -133,6 +133,28 @@ protected:
|
||||
//@}
|
||||
};
|
||||
|
||||
class ModularMixerBackend : virtual public BaseBackend {
|
||||
public:
|
||||
ModularMixerBackend();
|
||||
virtual ~ModularMixerBackend();
|
||||
|
||||
/** @name Sound */
|
||||
//@{
|
||||
|
||||
virtual MixerManager *getMixerManager();
|
||||
virtual Audio::Mixer *getMixer() override final;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
/** @name Managers variables */
|
||||
//@{
|
||||
|
||||
MixerManager *_mixerManager;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
class ModularMutexBackend : virtual public BaseBackend {
|
||||
public:
|
||||
ModularMutexBackend();
|
||||
|
@ -81,7 +81,6 @@ OSystem_SDL::OSystem_SDL()
|
||||
_initedSDLnet(false),
|
||||
#endif
|
||||
_logger(0),
|
||||
_mixerManager(0),
|
||||
_eventSource(0),
|
||||
_eventSourceWrapper(nullptr),
|
||||
_window(0) {
|
||||
@ -541,11 +540,6 @@ void OSystem_SDL::getTimeAndDate(TimeDate &td) const {
|
||||
td.tm_wday = t.tm_wday;
|
||||
}
|
||||
|
||||
Audio::Mixer *OSystem_SDL::getMixer() {
|
||||
assert(_mixerManager);
|
||||
return getMixerManager()->getMixer();
|
||||
}
|
||||
|
||||
MixerManager *OSystem_SDL::getMixerManager() {
|
||||
assert(_mixerManager);
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
/**
|
||||
* Base OSystem class for all SDL ports.
|
||||
*/
|
||||
class OSystem_SDL : public ModularMutexBackend, public ModularGraphicsBackend {
|
||||
class OSystem_SDL : public ModularMutexBackend, public ModularMixerBackend, public ModularGraphicsBackend {
|
||||
public:
|
||||
OSystem_SDL();
|
||||
virtual ~OSystem_SDL();
|
||||
@ -48,13 +48,6 @@ public:
|
||||
*/
|
||||
virtual void init() override;
|
||||
|
||||
/**
|
||||
* Get the Mixer Manager instance. Not to confuse with getMixer(),
|
||||
* that returns Audio::Mixer. The Mixer Manager is a SDL wrapper class
|
||||
* for the Audio::Mixer. Used by other managers.
|
||||
*/
|
||||
virtual MixerManager *getMixerManager();
|
||||
|
||||
virtual bool hasFeature(Feature f) override;
|
||||
|
||||
// Override functions from ModularBackend and OSystem
|
||||
@ -83,7 +76,7 @@ public:
|
||||
virtual uint32 getMillis(bool skipRecord = false) override;
|
||||
virtual void delayMillis(uint msecs) override;
|
||||
virtual void getTimeAndDate(TimeDate &td) const override;
|
||||
virtual Audio::Mixer *getMixer() override;
|
||||
virtual MixerManager *getMixerManager() override;
|
||||
virtual Common::TimerManager *getTimerManager() override;
|
||||
virtual Common::SaveFileManager *getSavefileManager() override;
|
||||
|
||||
@ -107,12 +100,6 @@ protected:
|
||||
*/
|
||||
Common::String _logFilePath;
|
||||
|
||||
/**
|
||||
* Mixer manager that configures and setups SDL for
|
||||
* the wrapped Audio::Mixer, the true mixer.
|
||||
*/
|
||||
MixerManager *_mixerManager;
|
||||
|
||||
/**
|
||||
* The event source we use for obtaining SDL events.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user