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/sdl2.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'Alc/backends/sdl2.cpp') diff --git a/Alc/backends/sdl2.cpp b/Alc/backends/sdl2.cpp index d61e0a1b..75052b0f 100644 --- a/Alc/backends/sdl2.cpp +++ b/Alc/backends/sdl2.cpp @@ -40,13 +40,15 @@ #endif struct ALCsdl2Backend final : public ALCbackend { - SDL_AudioDeviceID deviceID; - ALsizei frameSize; + SDL_AudioDeviceID deviceID{0u}; + ALsizei frameSize{0}; - ALuint Frequency; - DevFmtChannels FmtChans; - DevFmtType FmtType; - ALuint UpdateSize; + ALuint Frequency{0u}; + DevFmtChannels FmtChans{}; + DevFmtType FmtType{}; + ALuint UpdateSize{0u}; + + ALCsdl2Backend(ALCdevice *device) noexcept : ALCbackend{device} { } }; static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device); @@ -68,11 +70,9 @@ static const ALCchar defaultDeviceName[] = DEVNAME_PREFIX "Default Device"; static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device) { - new (self) ALCsdl2Backend{}; - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + new (self) ALCsdl2Backend{device}; SET_VTABLE2(ALCsdl2Backend, ALCbackend, self); - self->deviceID = 0; self->frameSize = device->frameSizeFromFmt(); self->Frequency = device->Frequency; self->FmtChans = device->FmtChans; @@ -86,7 +86,6 @@ static void ALCsdl2Backend_Destruct(ALCsdl2Backend *self) SDL_CloseAudioDevice(self->deviceID); self->deviceID = 0; - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~ALCsdl2Backend(); } -- cgit v1.2.3