aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alc.cpp7
-rw-r--r--Alc/backends/qsa.cpp48
-rw-r--r--Alc/backends/qsa.h20
-rw-r--r--CMakeLists.txt2
4 files changed, 40 insertions, 37 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 78fa0d9c..00442458 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -86,6 +86,9 @@
#ifdef HAVE_OSS
#include "backends/oss.h"
#endif
+#ifdef HAVE_QSA
+#include "backends/qsa.h"
+#endif
#ifdef HAVE_SDL2
#include "backends/sdl2.h"
#endif
@@ -132,9 +135,11 @@ struct BackendInfo BackendList[] = {
#ifdef HAVE_OSS
{ "oss", OSSBackendFactory::getFactory },
#endif
+#ifdef HAVE_QSA
+ { "qsa", QSABackendFactory::getFactory },
+#endif
#if 0
- { "qsa", ALCqsaBackendFactory_getFactory },
{ "dsound", ALCdsoundBackendFactory_getFactory },
{ "winmm", ALCwinmmBackendFactory_getFactory },
{ "port", ALCportBackendFactory_getFactory },
diff --git a/Alc/backends/qsa.cpp b/Alc/backends/qsa.cpp
index 3a99d71e..da4e6b64 100644
--- a/Alc/backends/qsa.cpp
+++ b/Alc/backends/qsa.cpp
@@ -20,6 +20,8 @@
#include "config.h"
+#include "backends/qsa.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <sched.h>
@@ -33,8 +35,6 @@
#include "alu.h"
#include "threads.h"
-#include "backends/base.h"
-
namespace {
@@ -163,8 +163,6 @@ void deviceList(int type, vector_DevMap *devmap)
}
}
-} // namespace
-
/* Wrappers to use an old-style backend with the new interface. */
struct PlaybackWrapper final : public ALCbackend {
@@ -991,29 +989,13 @@ static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self)
return qsa_available_samples(self);
}
+} // namespace
-struct ALCqsaBackendFactory final : public ALCbackendFactory {
- ALCqsaBackendFactory() noexcept;
-};
-
-static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self));
-static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self));
-static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type);
-static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames);
-static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type);
-DEFINE_ALCBACKENDFACTORY_VTABLE(ALCqsaBackendFactory);
-
-ALCqsaBackendFactory::ALCqsaBackendFactory() noexcept
- : ALCbackendFactory{GET_VTABLE2(ALCqsaBackendFactory, ALCbackendFactory)}
-{ }
+bool QSABackendFactory::init()
+{ return true; }
-static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self))
-{
- return ALC_TRUE;
-}
-
-static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self))
+void QSABackendFactory::deinit()
{
#define FREE_NAME(iter) free((iter)->name)
VECTOR_FOR_EACH(DevMap, DeviceNameMap, FREE_NAME);
@@ -1024,14 +1006,10 @@ static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self))
#undef FREE_NAME
}
-static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type)
-{
- if(type == ALCbackend_Playback || type == ALCbackend_Capture)
- return ALC_TRUE;
- return ALC_FALSE;
-}
+bool QSABackendFactory::querySupport(ALCbackend_Type type)
+{ return (type == ALCbackend_Playback || type == ALCbackend_Capture); }
-static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type, std::string *outnames)
+void QSABackendFactory::probe(enum DevProbe type, std::string *outnames)
{
switch (type)
{
@@ -1053,7 +1031,7 @@ static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum
}
}
-static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type)
+ALCbackend *QSABackendFactory::createBackend(ALCdevice *device, ALCbackend_Type type)
{
if(type == ALCbackend_Playback)
{
@@ -1073,8 +1051,8 @@ static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUS
return NULL;
}
-ALCbackendFactory *ALCqsaBackendFactory_getFactory(void)
+BackendFactory &QSABackendFactory::getFactory()
{
- static ALCqsaBackendFactory factory{};
- return STATIC_CAST(ALCbackendFactory, &factory);
+ static QSABackendFactory factory{};
+ return factory;
}
diff --git a/Alc/backends/qsa.h b/Alc/backends/qsa.h
new file mode 100644
index 00000000..c4941392
--- /dev/null
+++ b/Alc/backends/qsa.h
@@ -0,0 +1,20 @@
+#ifndef BACKENDS_QSA_H
+#define BACKENDS_QSA_H
+
+#include "backends/base.h"
+
+struct QSABackendFactory 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_QSA_H */
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4071a87..5d30bd6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1073,7 +1073,7 @@ IF(QSA_FOUND)
IF(ALSOFT_BACKEND_QSA)
SET(HAVE_QSA 1)
SET(BACKENDS "${BACKENDS} QSA (linked),")
- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.cpp)
+ SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.cpp Alc/backends/qsa.h)
SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS})
ENDIF()