summaryrefslogtreecommitdiff
path: root/drivers/pulseaudio
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-12 17:01:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 10:01:56 +0200
commit1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch)
tree8bebdce946466ce8e9476ccd46c9dba62c323938 /drivers/pulseaudio
parente7c9d818766a119089873e4941e4865fb36883ec (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/pulseaudio')
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp25
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.h36
2 files changed, 20 insertions, 41 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 8a47f6cf96..b16408f727 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -793,30 +793,9 @@ String AudioDriverPulseAudio::capture_get_device() {
return name;
}
-AudioDriverPulseAudio::AudioDriverPulseAudio() :
- thread(nullptr),
- pa_ml(nullptr),
- pa_ctx(nullptr),
- pa_str(nullptr),
- pa_rec_str(nullptr),
- device_name("Default"),
- new_device("Default"),
- default_device(""),
- mix_rate(0),
- buffer_frames(0),
- pa_buffer_size(0),
- channels(0),
- pa_ready(0),
- pa_status(0),
- active(false),
- thread_exited(false),
- exit_thread(false),
- latency(0) {
+AudioDriverPulseAudio::AudioDriverPulseAudio() {
samples_in.clear();
samples_out.clear();
}
-AudioDriverPulseAudio::~AudioDriverPulseAudio() {
-}
-
-#endif
+#endif // PULSEAUDIO_ENABLED
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h
index 1ece332a8a..ab55a15076 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.h
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.h
@@ -41,18 +41,18 @@
class AudioDriverPulseAudio : public AudioDriver {
- Thread *thread;
+ Thread *thread = nullptr;
Mutex mutex;
- pa_mainloop *pa_ml;
- pa_context *pa_ctx;
- pa_stream *pa_str;
- pa_stream *pa_rec_str;
+ pa_mainloop *pa_ml = nullptr;
+ pa_context *pa_ctx = nullptr;
+ pa_stream *pa_str = nullptr;
+ pa_stream *pa_rec_str = nullptr;
pa_channel_map pa_map;
pa_channel_map pa_rec_map;
- String device_name;
- String new_device;
+ String device_name = "Default";
+ String new_device = "Default";
String default_device;
String capture_device_name;
@@ -62,20 +62,20 @@ class AudioDriverPulseAudio : public AudioDriver {
Vector<int32_t> samples_in;
Vector<int16_t> samples_out;
- unsigned int mix_rate;
- unsigned int buffer_frames;
- unsigned int pa_buffer_size;
- int channels;
- int pa_ready;
- int pa_status;
+ unsigned int mix_rate = 0;
+ unsigned int buffer_frames = 0;
+ unsigned int pa_buffer_size = 0;
+ int channels = 0;
+ int pa_ready = 0;
+ int pa_status = 0;
Array pa_devices;
Array pa_rec_devices;
- bool active;
- bool thread_exited;
- mutable bool exit_thread;
+ bool active = false;
+ bool thread_exited = false;
+ mutable bool exit_thread = false;
- float latency;
+ float latency = 0;
static void pa_state_cb(pa_context *c, void *userdata);
static void pa_sink_info_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata);
@@ -122,7 +122,7 @@ public:
virtual Error capture_stop();
AudioDriverPulseAudio();
- ~AudioDriverPulseAudio();
+ ~AudioDriverPulseAudio() {}
};
#endif // AUDIO_DRIVER_PULSEAUDIO_H