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 /servers/audio | |
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 'servers/audio')
-rw-r--r-- | servers/audio/effects/audio_effect_record.h | 5 | ||||
-rw-r--r-- | servers/audio/effects/reverb.cpp | 5 | ||||
-rw-r--r-- | servers/audio/effects/reverb.h | 42 |
3 files changed, 20 insertions, 32 deletions
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h index 09101033be..68d968c04b 100644 --- a/servers/audio/effects/audio_effect_record.h +++ b/servers/audio/effects/audio_effect_record.h @@ -49,7 +49,7 @@ class AudioEffectRecordInstance : public AudioEffectInstance { bool is_recording; Thread *io_thread; - bool thread_active; + bool thread_active = false; Vector<AudioFrame> ring_buffer; Vector<float> recording_data; @@ -71,8 +71,7 @@ public: virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count); virtual bool process_silence() const; - AudioEffectRecordInstance() : - thread_active(false) {} + AudioEffectRecordInstance() {} ~AudioEffectRecordInstance(); }; diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp index ea2174f1d4..02565f4516 100644 --- a/servers/audio/effects/reverb.cpp +++ b/servers/audio/effects/reverb.cpp @@ -31,7 +31,9 @@ // Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006 #include "reverb.h" + #include "core/math/math_funcs.h" + #include <math.h> const float Reverb::comb_tunings[MAX_COMBS] = { @@ -338,11 +340,8 @@ Reverb::Reverb() { params.predelay = 150; params.predelay_fb = 0.4; params.hpf = 0; - hpf_h1 = 0; - hpf_h2 = 0; input_buffer = memnew_arr(float, INPUT_BUFFER_MAX_SIZE); - echo_buffer = nullptr; configure_buffers(); update_parameters(); diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h index 92e4aed435..ed8c824148 100644 --- a/servers/audio/effects/reverb.h +++ b/servers/audio/effects/reverb.h @@ -58,44 +58,34 @@ private: struct Comb { - int size; - float *buffer; - float feedback; - float damp; //lowpass - float damp_h; //history - int pos; - int extra_spread_frames; - - Comb() { - size = 0; - buffer = 0; - feedback = 0; - damp_h = 0; - pos = 0; - } + int size = 0; + float *buffer = nullptr; + float feedback = 0; + float damp = 0; //lowpass + float damp_h = 0; //history + int pos = 0; + int extra_spread_frames = 0; + + Comb() {} }; struct AllPass { - int size; - float *buffer; - int pos; - int extra_spread_frames; - AllPass() { - size = 0; - buffer = 0; - pos = 0; - } + int size = 0; + float *buffer = nullptr; + int pos = 0; + int extra_spread_frames = 0; + AllPass() {} }; Comb comb[MAX_COMBS]; AllPass allpass[MAX_ALLPASS]; float *input_buffer; - float *echo_buffer; + float *echo_buffer = nullptr; int echo_buffer_size; int echo_buffer_pos; - float hpf_h1, hpf_h2; + float hpf_h1, hpf_h2 = 0; struct Parameters { |