From 1f6f364a56319eabd02c050746fe7df3f55ffee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 12 May 2020 17:01:17 +0200 Subject: 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. --- drivers/coreaudio/audio_driver_coreaudio.cpp | 15 ++------------- drivers/coreaudio/audio_driver_coreaudio.h | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 23 deletions(-) (limited to 'drivers/coreaudio') diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index 21c3649445..76d2d13dfe 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -676,19 +676,8 @@ String AudioDriverCoreAudio::capture_get_device() { #endif -AudioDriverCoreAudio::AudioDriverCoreAudio() : - audio_unit(nullptr), - input_unit(nullptr), - active(false), - device_name("Default"), - capture_device_name("Default"), - mix_rate(0), - channels(2), - capture_channels(2), - buffer_frames(0) { +AudioDriverCoreAudio::AudioDriverCoreAudio() { samples_in.clear(); } -AudioDriverCoreAudio::~AudioDriverCoreAudio(){}; - -#endif +#endif // COREAUDIO_ENABLED diff --git a/drivers/coreaudio/audio_driver_coreaudio.h b/drivers/coreaudio/audio_driver_coreaudio.h index fb9473e230..89dd52181f 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.h +++ b/drivers/coreaudio/audio_driver_coreaudio.h @@ -42,19 +42,19 @@ class AudioDriverCoreAudio : public AudioDriver { - AudioComponentInstance audio_unit; - AudioComponentInstance input_unit; + AudioComponentInstance audio_unit = nullptr; + AudioComponentInstance input_unit = nullptr; - bool active; + bool active = false; Mutex mutex; - String device_name; - String capture_device_name; + String device_name = "Default"; + String capture_device_name = "Default"; - int mix_rate; - unsigned int channels; - unsigned int capture_channels; - unsigned int buffer_frames; + int mix_rate = 0; + unsigned int channels = 2; + unsigned int capture_channels = 2; + unsigned int buffer_frames = 0; Vector samples_in; Vector input_buf; @@ -118,7 +118,7 @@ public: #endif AudioDriverCoreAudio(); - ~AudioDriverCoreAudio(); + ~AudioDriverCoreAudio() {} }; #endif -- cgit v1.2.3