aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/sdl2.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-27 13:40:43 -0800
committerChris Robinson <[email protected]>2018-12-27 13:40:43 -0800
commit4782d6107d250e3528c5e567dca48da727584ee7 (patch)
tree05679c4196c4dacfce65991fa4caa7862cf1c381 /Alc/backends/sdl2.cpp
parent7880f27054cd69cd1e36ebd3d20aa9d6148e3bbd (diff)
Use a proper constructor/destructor for the ALCbackend base
Diffstat (limited to 'Alc/backends/sdl2.cpp')
-rw-r--r--Alc/backends/sdl2.cpp19
1 files changed, 9 insertions, 10 deletions
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();
}