diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-12 17:01:17 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 10:01:56 +0200 |
commit | 1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch) | |
tree | 8bebdce946466ce8e9476ccd46c9dba62c323938 /drivers/xaudio2 | |
parent | e7c9d818766a119089873e4941e4865fb36883ec (diff) |
Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.
Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
Diffstat (limited to 'drivers/xaudio2')
-rw-r--r-- | drivers/xaudio2/audio_driver_xaudio2.cpp | 8 | ||||
-rw-r--r-- | drivers/xaudio2/audio_driver_xaudio2.h | 8 |
2 files changed, 5 insertions, 11 deletions
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 120bfa2b36..d12ebf8d94 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -196,15 +196,9 @@ void AudioDriverXAudio2::finish() { thread = nullptr; } -AudioDriverXAudio2::AudioDriverXAudio2() : - thread(nullptr), - current_buffer(0) { - wave_format = { 0 }; +AudioDriverXAudio2::AudioDriverXAudio2() { for (int i = 0; i < AUDIO_BUFFERS; i++) { xaudio_buffer[i] = { 0 }; samples_out[i] = 0; } } - -AudioDriverXAudio2::~AudioDriverXAudio2() { -} diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h index eb4a6d6e95..9182fa4172 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.h +++ b/drivers/xaudio2/audio_driver_xaudio2.h @@ -64,7 +64,7 @@ class AudioDriverXAudio2 : public AudioDriver { void STDMETHODCALLTYPE OnVoiceError(void *pBufferContext, HRESULT Error) {} }; - Thread *thread; + Thread *thread = nullptr; Mutex mutex; int32_t *samples_in; @@ -83,9 +83,9 @@ class AudioDriverXAudio2 : public AudioDriver { mutable bool exit_thread; bool pcm_open; - WAVEFORMATEX wave_format; + WAVEFORMATEX wave_format = { 0 }; Microsoft::WRL::ComPtr<IXAudio2> xaudio; - int current_buffer; + int current_buffer = 0; IXAudio2MasteringVoice *mastering_voice; XAUDIO2_BUFFER xaudio_buffer[AUDIO_BUFFERS]; IXAudio2SourceVoice *source_voice; @@ -104,7 +104,7 @@ public: virtual void finish(); AudioDriverXAudio2(); - ~AudioDriverXAudio2(); + ~AudioDriverXAudio2() {} }; #endif |