diff options
author | Chris Robinson <[email protected]> | 2018-12-27 13:40:43 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-27 13:40:43 -0800 |
commit | 4782d6107d250e3528c5e567dca48da727584ee7 (patch) | |
tree | 05679c4196c4dacfce65991fa4caa7862cf1c381 /Alc/backends/qsa.cpp | |
parent | 7880f27054cd69cd1e36ebd3d20aa9d6148e3bbd (diff) |
Use a proper constructor/destructor for the ALCbackend base
Diffstat (limited to 'Alc/backends/qsa.cpp')
-rw-r--r-- | Alc/backends/qsa.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Alc/backends/qsa.cpp b/Alc/backends/qsa.cpp index f14718c0..ff74ff21 100644 --- a/Alc/backends/qsa.cpp +++ b/Alc/backends/qsa.cpp @@ -172,6 +172,8 @@ void deviceList(int type, al::vector<DevMap> *devmap) /* Wrappers to use an old-style backend with the new interface. */ struct PlaybackWrapper final : public ALCbackend { std::unique_ptr<qsa_data> ExtraData; + + PlaybackWrapper(ALCdevice *device) noexcept : ALCbackend{device} { } }; static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device); @@ -613,11 +615,8 @@ static void qsa_stop_playback(PlaybackWrapper *self) static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device) { - new (self) PlaybackWrapper{}; - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + new (self) PlaybackWrapper{device}; SET_VTABLE2(PlaybackWrapper, ALCbackend, self); - - self->ExtraData = NULL; } static void PlaybackWrapper_Destruct(PlaybackWrapper *self) @@ -625,7 +624,6 @@ static void PlaybackWrapper_Destruct(PlaybackWrapper *self) if(self->ExtraData) qsa_close_playback(self); - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~PlaybackWrapper(); } @@ -657,6 +655,8 @@ static void PlaybackWrapper_stop(PlaybackWrapper *self) struct CaptureWrapper final : public ALCbackend { std::unique_ptr<qsa_data> ExtraData; + + CaptureWrapper(ALCdevice *device) noexcept : ALCbackend{device} { } }; static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device); @@ -916,8 +916,7 @@ static ALCenum qsa_capture_samples(CaptureWrapper *self, ALCvoid *buffer, ALCuin static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device) { - new (self) CaptureWrapper{}; - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + new (self) CaptureWrapper{device}; SET_VTABLE2(CaptureWrapper, ALCbackend, self); } @@ -926,7 +925,6 @@ static void CaptureWrapper_Destruct(CaptureWrapper *self) if(self->ExtraData) qsa_close_capture(self); - ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); self->~CaptureWrapper(); } |