diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/alsa.c | 62 | ||||
-rw-r--r-- | Alc/backends/loopback.c | 17 | ||||
-rw-r--r-- | Alc/backends/null.c | 39 |
3 files changed, 40 insertions, 78 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 0bed0d4b..586c1bf6 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -451,10 +451,12 @@ typedef struct ALCplaybackAlsa { volatile int killNow; althread_t thread; } ALCplaybackAlsa; +DECLARE_ALCBACKEND_VTABLE(ALCplaybackAlsa); static ALuint ALCplaybackAlsa_mixerProc(ALvoid *ptr); static ALuint ALCplaybackAlsa_mixerNoMMapProc(ALvoid *ptr); +static DECLARE_FORWARD(ALCplaybackAlsa, ALCbackend, void, Destruct) static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name); static void ALCplaybackAlsa_close(ALCplaybackAlsa *self); static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self); @@ -462,8 +464,15 @@ static ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self); static void ALCplaybackAlsa_stop(ALCplaybackAlsa *self); static ALCenum ALCplaybackAlsa_captureSamples(ALCplaybackAlsa *self, ALCvoid *buffer, ALCuint samples); static ALCuint ALCplaybackAlsa_availableSamples(ALCplaybackAlsa *self); -static void ALCplaybackAlsa_lock(ALCplaybackAlsa *self); -static void ALCplaybackAlsa_unlock(ALCplaybackAlsa *self); +static DECLARE_FORWARD(ALCplaybackAlsa, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCplaybackAlsa, ALCbackend, void, unlock) + + +static void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCplaybackAlsa, ALCbackend, self); +} static ALuint ALCplaybackAlsa_mixerProc(ALvoid *ptr) @@ -947,22 +956,6 @@ static ALint64 ALCplaybackAlsa_getLatency(ALCplaybackAlsa *self) return maxi64((ALint64)delay*1000000000/device->Frequency, 0); } -static void ALCplaybackAlsa_lock(ALCplaybackAlsa *self) -{ ALCbackend_lock(STATIC_CAST(ALCbackend, self)); } - -static void ALCplaybackAlsa_unlock(ALCplaybackAlsa *self) -{ ALCbackend_unlock(STATIC_CAST(ALCbackend, self)); } - - -static void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); -} - -static void ALCplaybackAlsa_Destruct(ALCplaybackAlsa *self) -{ - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); -} static void ALCplaybackAlsa_Delete(ALCplaybackAlsa *self) { @@ -985,7 +978,9 @@ typedef struct ALCcaptureAlsa { snd_pcm_sframes_t last_avail; } ALCcaptureAlsa; +DECLARE_ALCBACKEND_VTABLE(ALCcaptureAlsa); +static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, void, Destruct) static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name); static void ALCcaptureAlsa_close(ALCcaptureAlsa *self); static ALCboolean ALCcaptureAlsa_reset(ALCcaptureAlsa *self); @@ -993,8 +988,16 @@ static ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self); static void ALCcaptureAlsa_stop(ALCcaptureAlsa *self); static ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buffer, ALCuint samples); static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self); -static void ALCcaptureAlsa_lock(ALCcaptureAlsa *self); -static void ALCcaptureAlsa_unlock(ALCcaptureAlsa *self); +static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, void, unlock) + + +static void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCcaptureAlsa, ALCbackend, self); +} + static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) { @@ -1356,23 +1359,6 @@ static ALint64 ALCcaptureAlsa_getLatency(ALCcaptureAlsa *self) return maxi64((ALint64)delay*1000000000/device->Frequency, 0); } -static void ALCcaptureAlsa_lock(ALCcaptureAlsa *self) -{ ALCbackend_lock(STATIC_CAST(ALCbackend, self)); } - -static void ALCcaptureAlsa_unlock(ALCcaptureAlsa *self) -{ ALCbackend_unlock(STATIC_CAST(ALCbackend, self)); } - - -static void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); -} - -static void ALCcaptureAlsa_Destruct(ALCcaptureAlsa *self) -{ - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); -} - static void ALCcaptureAlsa_Delete(ALCcaptureAlsa *self) { free(self); @@ -1474,7 +1460,6 @@ ALCbackend* ALCalsaBackendFactory_createBackend(ALCalsaBackendFactory* UNUSED(se backend = calloc(1, sizeof(*backend)); if(!backend) return NULL; - SET_VTABLE2(ALCplaybackAlsa, ALCbackend, backend); ALCplaybackAlsa_Construct(backend, device); @@ -1486,7 +1471,6 @@ ALCbackend* ALCalsaBackendFactory_createBackend(ALCalsaBackendFactory* UNUSED(se backend = calloc(1, sizeof(*backend)); if(!backend) return NULL; - SET_VTABLE2(ALCcaptureAlsa, ALCbackend, backend); ALCcaptureAlsa_Construct(backend, device); diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c index bb5dd503..e400fcf2 100644 --- a/Alc/backends/loopback.c +++ b/Alc/backends/loopback.c @@ -33,7 +33,10 @@ typedef struct ALCloopback { } ALCloopback; DECLARE_ALCBACKEND_VTABLE(ALCloopback); -#define ALCNULLBACKEND_INITIALIZER { { GET_VTABLE2(ALCbackend, ALCloopback) } } +static DECLARE_FORWARD(ALCloopback, ALCbackend, void, Destruct) +static DECLARE_FORWARD(ALCloopback, ALCbackend, ALint64, getLatency) +static DECLARE_FORWARD(ALCloopback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCloopback, ALCbackend, void, unlock) static void ALCloopback_Construct(ALCloopback *self, ALCdevice *device) @@ -42,10 +45,6 @@ static void ALCloopback_Construct(ALCloopback *self, ALCdevice *device) SET_VTABLE2(ALCloopback, ALCbackend, self); } -static void ALCloopback_Destruct(ALCloopback *self) -{ - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); -} static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name) { @@ -84,14 +83,6 @@ ALCuint ALCloopback_availableSamples(ALCloopback* UNUSED(self)) return 0; } -static ALint64 ALCloopback_getLatency(ALCloopback *self) -{ return ALCbackend_getLatency(STATIC_CAST(ALCbackend, self)); } - -static void ALCloopback_lock(ALCloopback *self) -{ ALCbackend_lock(STATIC_CAST(ALCbackend, self)); } - -static void ALCloopback_unlock(ALCloopback *self) -{ ALCbackend_unlock(STATIC_CAST(ALCbackend, self)); } static void ALCloopback_Delete(ALCloopback *self) { diff --git a/Alc/backends/null.c b/Alc/backends/null.c index c5b178de..8eeb2689 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -39,11 +39,23 @@ typedef struct ALCnullBackend { volatile int killNow; althread_t thread; } ALCnullBackend; -#define ALCNULLBACKEND_INITIALIZER { { GET_VTABLE2(ALCbackend, ALCnullBackend) } } +DECLARE_ALCBACKEND_VTABLE(ALCnullBackend); +static DECLARE_FORWARD(ALCnullBackend, ALCbackend, void, Destruct) +static DECLARE_FORWARD(ALCnullBackend, ALCbackend, ALint64, getLatency) +static DECLARE_FORWARD(ALCnullBackend, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCnullBackend, ALCbackend, void, unlock) static const ALCchar nullDevice[] = "No Output"; + +static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCnullBackend, ALCbackend, self); +} + + static ALuint ALCnullBackend_mixerProc(ALvoid *ptr) { ALCnullBackend *self = (ALCnullBackend*)ptr; @@ -86,16 +98,6 @@ static ALuint ALCnullBackend_mixerProc(ALvoid *ptr) } -static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); -} - -static void ALCnullBackend_Destruct(ALCnullBackend *self) -{ - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); -} - static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name) { ALCdevice *device; @@ -150,20 +152,6 @@ ALCuint ALCnullBackend_availableSamples(ALCnullBackend* UNUSED(self)) return 0; } -static ALint64 ALCnullBackend_getLatency(ALCnullBackend *self) -{ - return ALCbackend_getLatency(STATIC_CAST(ALCbackend, self)); -} - -static void ALCnullBackend_lock(ALCnullBackend *self) -{ - ALCbackend_lock(STATIC_CAST(ALCbackend, self)); -} - -static void ALCnullBackend_unlock(ALCnullBackend *self) -{ - ALCbackend_unlock(STATIC_CAST(ALCbackend, self)); -} static void ALCnullBackend_Delete(ALCnullBackend *self) { @@ -214,7 +202,6 @@ ALCbackend* ALCnullBackendFactory_createBackend(ALCnullBackendFactory* UNUSED(se backend = calloc(1, sizeof(*backend)); if(!backend) return NULL; - SET_VTABLE2(ALCnullBackend, ALCbackend, backend); ALCnullBackend_Construct(backend, device); |