aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-11-04 10:51:22 -0800
committerChris Robinson <[email protected]>2013-11-04 10:51:22 -0800
commit94aeb5f52e656e021ce626ef523fb4a29cce117f (patch)
treef74af6730dc80774fb414a61d5f4a3193b5a0eb7 /Alc/backends
parent9760a592b263f41b5fc8b7d5668ae538066acc7d (diff)
Use a unique backend type for loopback
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/base.h3
-rw-r--r--Alc/backends/loopback.c59
2 files changed, 31 insertions, 31 deletions
diff --git a/Alc/backends/base.h b/Alc/backends/base.h
index 607ca6e8..1bbc1fb0 100644
--- a/Alc/backends/base.h
+++ b/Alc/backends/base.h
@@ -82,7 +82,8 @@ DECLARE_ALCBACKEND_VTABLE(T) = { \
typedef enum ALCbackend_Type {
ALCbackend_Playback,
- ALCbackend_Capture
+ ALCbackend_Capture,
+ ALCbackend_Loopback
} ALCbackend_Type;
diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c
index e400fcf2..cd5b1a1e 100644
--- a/Alc/backends/loopback.c
+++ b/Alc/backends/loopback.c
@@ -31,12 +31,21 @@
typedef struct ALCloopback {
DERIVE_FROM_TYPE(ALCbackend);
} ALCloopback;
-DECLARE_ALCBACKEND_VTABLE(ALCloopback);
+static void ALCloopback_Construct(ALCloopback *self, ALCdevice *device);
static DECLARE_FORWARD(ALCloopback, ALCbackend, void, Destruct)
+static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name);
+static void ALCloopback_close(ALCloopback *self);
+static ALCboolean ALCloopback_reset(ALCloopback *self);
+static ALCboolean ALCloopback_start(ALCloopback *self);
+static void ALCloopback_stop(ALCloopback *self);
+static DECLARE_FORWARD2(ALCloopback, ALCbackend, ALCenum, captureSamples, void*, ALCuint)
+static DECLARE_FORWARD(ALCloopback, ALCbackend, ALCuint, availableSamples)
static DECLARE_FORWARD(ALCloopback, ALCbackend, ALint64, getLatency)
static DECLARE_FORWARD(ALCloopback, ALCbackend, void, lock)
static DECLARE_FORWARD(ALCloopback, ALCbackend, void, unlock)
+static void ALCloopback_Delete(ALCloopback *self);
+DEFINE_ALCBACKEND_VTABLE(ALCloopback);
static void ALCloopback_Construct(ALCloopback *self, ALCdevice *device)
@@ -73,55 +82,54 @@ static void ALCloopback_stop(ALCloopback* UNUSED(self))
{
}
-ALCenum ALCloopback_captureSamples(ALCloopback* UNUSED(self), void* UNUSED(buffer), ALCuint UNUSED(samples))
-{
- return ALC_INVALID_VALUE;
-}
-
-ALCuint ALCloopback_availableSamples(ALCloopback* UNUSED(self))
-{
- return 0;
-}
-
static void ALCloopback_Delete(ALCloopback *self)
{
free(self);
}
-DEFINE_ALCBACKEND_VTABLE(ALCloopback);
-
typedef struct ALCloopbackFactory {
DERIVE_FROM_TYPE(ALCbackendFactory);
} ALCloopbackFactory;
#define ALCNULLBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCloopbackFactory, ALCbackendFactory) } }
-ALCboolean ALCloopbackFactory_init(ALCloopbackFactory* UNUSED(self))
+ALCbackendFactory *ALCloopbackFactory_getFactory(void);
+static ALCboolean ALCloopbackFactory_init(ALCloopbackFactory *self);
+static DECLARE_FORWARD(ALCloopbackFactory, ALCbackendFactory, void, deinit)
+static ALCboolean ALCloopbackFactory_querySupport(ALCloopbackFactory *self, ALCbackend_Type type);
+static void ALCloopbackFactory_probe(ALCloopbackFactory *self, enum DevProbe type);
+static ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory *self, ALCdevice *device, ALCbackend_Type type);
+DEFINE_ALCBACKENDFACTORY_VTABLE(ALCloopbackFactory);
+
+
+ALCbackendFactory *ALCloopbackFactory_getFactory(void)
{
- return ALC_TRUE;
+ static ALCloopbackFactory factory = ALCNULLBACKENDFACTORY_INITIALIZER;
+ return STATIC_CAST(ALCbackendFactory, &factory);
}
-void ALCloopbackFactory_deinit(ALCloopbackFactory* UNUSED(self))
+static ALCboolean ALCloopbackFactory_init(ALCloopbackFactory* UNUSED(self))
{
+ return ALC_TRUE;
}
-ALCboolean ALCloopbackFactory_querySupport(ALCloopbackFactory* UNUSED(self), ALCbackend_Type type)
+static ALCboolean ALCloopbackFactory_querySupport(ALCloopbackFactory* UNUSED(self), ALCbackend_Type type)
{
- if(type == ALCbackend_Playback)
+ if(type == ALCbackend_Loopback)
return ALC_TRUE;
return ALC_FALSE;
}
-void ALCloopbackFactory_probe(ALCloopbackFactory* UNUSED(self), enum DevProbe UNUSED(type))
+static void ALCloopbackFactory_probe(ALCloopbackFactory* UNUSED(self), enum DevProbe UNUSED(type))
{
}
-ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type)
+static ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type)
{
ALCloopback *backend;
- assert(type == ALCbackend_Playback);
+ assert(type == ALCbackend_Loopback);
backend = calloc(1, sizeof(*backend));
if(!backend) return NULL;
@@ -130,12 +138,3 @@ ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory* UNUSED(self), A
return STATIC_CAST(ALCbackend, backend);
}
-
-DEFINE_ALCBACKENDFACTORY_VTABLE(ALCloopbackFactory);
-
-
-ALCbackendFactory *ALCloopbackFactory_getFactory(void)
-{
- static ALCloopbackFactory factory = ALCNULLBACKENDFACTORY_INITIALIZER;
- return STATIC_CAST(ALCbackendFactory, &factory);
-}