diff options
author | Chris Robinson <[email protected]> | 2018-11-15 22:23:29 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-15 22:23:29 -0800 |
commit | 271cfcf8e31d06dca259a436251b70f5ffa882be (patch) | |
tree | 5439ff1f85aad9786bbbe63a953cbabc13486de3 /Alc/backends | |
parent | d73d01548d992f6f683f6685ff8f4767e8843ad9 (diff) |
Convert the Solaris backend factory
Diffstat (limited to 'Alc/backends')
-rw-r--r-- | Alc/backends/solaris.cpp | 45 | ||||
-rw-r--r-- | Alc/backends/solaris.h | 20 |
2 files changed, 31 insertions, 34 deletions
diff --git a/Alc/backends/solaris.cpp b/Alc/backends/solaris.cpp index 20dda617..029ef1a5 100644 --- a/Alc/backends/solaris.cpp +++ b/Alc/backends/solaris.cpp @@ -20,6 +20,8 @@ #include "config.h" +#include "backends/solaris.h" + #include <sys/ioctl.h> #include <sys/types.h> #include <sys/time.h> @@ -38,8 +40,6 @@ #include "threads.h" #include "compat.h" -#include "backends/base.h" - #include <sys/audioio.h> @@ -293,45 +293,22 @@ static void ALCsolarisBackend_stop(ALCsolarisBackend *self) } -struct ALCsolarisBackendFactory final : public ALCbackendFactory { - ALCsolarisBackendFactory() noexcept; -}; - -ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void); - -static ALCboolean ALCsolarisBackendFactory_init(ALCsolarisBackendFactory *self); -static DECLARE_FORWARD(ALCsolarisBackendFactory, ALCbackendFactory, void, deinit) -static ALCboolean ALCsolarisBackendFactory_querySupport(ALCsolarisBackendFactory *self, ALCbackend_Type type); -static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory *self, enum DevProbe type, std::string *outnames); -static ALCbackend* ALCsolarisBackendFactory_createBackend(ALCsolarisBackendFactory *self, ALCdevice *device, ALCbackend_Type type); -DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsolarisBackendFactory); - - -ALCsolarisBackendFactory::ALCsolarisBackendFactory() noexcept - : ALCbackendFactory{GET_VTABLE2(ALCsolarisBackendFactory, ALCbackendFactory)} -{ } - -ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void) +BackendFactory &SolarisBackendFactory::getFactory() { - static ALCsolarisBackendFactory factory{}; - return STATIC_CAST(ALCbackendFactory, &factory); + static SolarisBackendFactory factory{}; + return factory; } - -static ALCboolean ALCsolarisBackendFactory_init(ALCsolarisBackendFactory* UNUSED(self)) +bool SolarisBackendFactory::init() { ConfigValueStr(nullptr, "solaris", "device", &solaris_driver); - return ALC_TRUE; + return true; } -static ALCboolean ALCsolarisBackendFactory_querySupport(ALCsolarisBackendFactory* UNUSED(self), ALCbackend_Type type) -{ - if(type == ALCbackend_Playback) - return ALC_TRUE; - return ALC_FALSE; -} +bool SolarisBackendFactory::querySupport(ALCbackend_Type type) +{ return (type == ALCbackend_Playback); } -static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames) +void SolarisBackendFactory::probe(enum DevProbe type, std::string *outnames) { switch(type) { @@ -350,7 +327,7 @@ static void ALCsolarisBackendFactory_probe(ALCsolarisBackendFactory* UNUSED(self } } -ALCbackend* ALCsolarisBackendFactory_createBackend(ALCsolarisBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +ALCbackend *SolarisBackendFactory::createBackend(ALCdevice *device, ALCbackend_Type type) { if(type == ALCbackend_Playback) { diff --git a/Alc/backends/solaris.h b/Alc/backends/solaris.h new file mode 100644 index 00000000..dcb34570 --- /dev/null +++ b/Alc/backends/solaris.h @@ -0,0 +1,20 @@ +#ifndef BACKENDS_SOLARIS_H +#define BACKENDS_SOLARIS_H + +#include "backends/base.h" + +struct SolarisBackendFactory final : public BackendFactory { +public: + bool init() override; + /*void deinit() override;*/ + + bool querySupport(ALCbackend_Type type) override; + + void probe(enum DevProbe type, std::string *outnames) override; + + ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; + + static BackendFactory &getFactory(); +}; + +#endif /* BACKENDS_SOLARIS_H */ |