From 4782d6107d250e3528c5e567dca48da727584ee7 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 27 Dec 2018 13:40:43 -0800 Subject: Use a proper constructor/destructor for the ALCbackend base --- Alc/backends/portaudio.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Alc/backends/portaudio.cpp') diff --git a/Alc/backends/portaudio.cpp b/Alc/backends/portaudio.cpp index 354389c3..f49c0d2c 100644 --- a/Alc/backends/portaudio.cpp +++ b/Alc/backends/portaudio.cpp @@ -134,6 +134,8 @@ struct ALCportPlayback final : public ALCbackend { PaStream *Stream{nullptr}; PaStreamParameters Params; ALuint UpdateSize{0u}; + + ALCportPlayback(ALCdevice *device) noexcept : ALCbackend{device} { } }; int ALCportPlayback_WriteCallback(const void *inputBuffer, void *outputBuffer, @@ -158,8 +160,7 @@ DEFINE_ALCBACKEND_VTABLE(ALCportPlayback); void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device) { - new (self) ALCportPlayback{}; - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + new (self) ALCportPlayback{device}; SET_VTABLE2(ALCportPlayback, ALCbackend, self); } @@ -170,7 +171,6 @@ void ALCportPlayback_Destruct(ALCportPlayback *self) ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); self->Stream = nullptr; - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~ALCportPlayback(); } @@ -320,6 +320,8 @@ struct ALCportCapture final : public ALCbackend { PaStreamParameters Params; RingBufferPtr Ring{nullptr}; + + ALCportCapture(ALCdevice *device) noexcept : ALCbackend{device} { } }; int ALCportCapture_ReadCallback(const void *inputBuffer, void *outputBuffer, @@ -344,8 +346,7 @@ DEFINE_ALCBACKEND_VTABLE(ALCportCapture); void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device) { - new (self) ALCportCapture{}; - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + new (self) ALCportCapture{device}; SET_VTABLE2(ALCportCapture, ALCbackend, self); } @@ -356,7 +357,6 @@ void ALCportCapture_Destruct(ALCportCapture *self) ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); self->Stream = nullptr; - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~ALCportCapture(); } -- cgit v1.2.3