diff options
author | Chris Robinson <[email protected]> | 2018-12-28 22:56:20 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-28 22:56:20 -0800 |
commit | 3d92e8c4df4ebaffbe44507f787f2382e3982c96 (patch) | |
tree | fe8f068a902d6b8f5f225120505529d1f6fe31cd /Alc/backends/loopback.cpp | |
parent | 67b874328d60062558eeb5068a3f79dab2b6f7e3 (diff) |
Convert the backends to use proper inheritence
Diffstat (limited to 'Alc/backends/loopback.cpp')
-rw-r--r-- | Alc/backends/loopback.cpp | 65 |
1 files changed, 18 insertions, 47 deletions
diff --git a/Alc/backends/loopback.cpp b/Alc/backends/loopback.cpp index eadacdfb..373b11c9 100644 --- a/Alc/backends/loopback.cpp +++ b/Alc/backends/loopback.cpp @@ -28,59 +28,35 @@ namespace { -struct ALCloopback final : public ALCbackend { - ALCloopback(ALCdevice *device) noexcept : ALCbackend{device} { } -}; +struct LoopbackBackend final : public BackendBase { + LoopbackBackend(ALCdevice *device) noexcept : BackendBase{device} { } -void ALCloopback_Construct(ALCloopback *self, ALCdevice *device); -void ALCloopback_Destruct(ALCloopback *self); -ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name); -ALCboolean ALCloopback_reset(ALCloopback *self); -ALCboolean ALCloopback_start(ALCloopback *self); -void ALCloopback_stop(ALCloopback *self); -DECLARE_FORWARD2(ALCloopback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) -DECLARE_FORWARD(ALCloopback, ALCbackend, ALCuint, availableSamples) -DECLARE_FORWARD(ALCloopback, ALCbackend, ClockLatency, getClockLatency) -DECLARE_FORWARD(ALCloopback, ALCbackend, void, lock) -DECLARE_FORWARD(ALCloopback, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(ALCloopback) -DEFINE_ALCBACKEND_VTABLE(ALCloopback); - - -void ALCloopback_Construct(ALCloopback *self, ALCdevice *device) -{ - new (self) ALCloopback{device}; - SET_VTABLE2(ALCloopback, ALCbackend, self); -} + ALCenum open(const ALCchar *name) override; + ALCboolean reset() override; + ALCboolean start() override; + void stop() override; -void ALCloopback_Destruct(ALCloopback *self) -{ - self->~ALCloopback(); -} + DEF_NEWDEL(LoopbackBackend) +}; -ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name) +ALCenum LoopbackBackend::open(const ALCchar *name) { - ALCdevice *device{self->mDevice}; - - device->DeviceName = name; + mDevice->DeviceName = name; return ALC_NO_ERROR; } -ALCboolean ALCloopback_reset(ALCloopback *self) +ALCboolean LoopbackBackend::reset() { - SetDefaultWFXChannelOrder(self->mDevice); + SetDefaultWFXChannelOrder(mDevice); return ALC_TRUE; } -ALCboolean ALCloopback_start(ALCloopback* UNUSED(self)) -{ - return ALC_TRUE; -} +ALCboolean LoopbackBackend::start() +{ return ALC_TRUE; } -void ALCloopback_stop(ALCloopback* UNUSED(self)) -{ -} +void LoopbackBackend::stop() +{ } } // namespace @@ -94,15 +70,10 @@ bool LoopbackBackendFactory::querySupport(ALCbackend_Type type) void LoopbackBackendFactory::probe(DevProbe, std::string*) { } -ALCbackend *LoopbackBackendFactory::createBackend(ALCdevice *device, ALCbackend_Type type) +BackendBase *LoopbackBackendFactory::createBackend(ALCdevice *device, ALCbackend_Type type) { if(type == ALCbackend_Loopback) - { - ALCloopback *backend; - NEW_OBJ(backend, ALCloopback)(device); - return backend; - } - + new LoopbackBackend{device}; return nullptr; } |