From c273ddc3eefce78f8eed86dbc71fffd1b0443e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 2 May 2022 16:28:25 +0200 Subject: Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init` Didn't commit all the changes where it wants to initialize a struct with `{}`. Should be reviewed in a separate PR. Option `IgnoreArrays` enabled for now to be conservative, can be disabled to see if it proposes more useful changes. Also fixed manually a handful of other missing initializations / moved some from constructors. --- servers/audio/effects/audio_effect_stereo_enhance.cpp | 8 +++----- servers/audio/effects/audio_effect_stereo_enhance.h | 18 +++++++++--------- servers/audio/effects/reverb.cpp | 2 -- servers/audio/effects/reverb.h | 7 ++++--- 4 files changed, 16 insertions(+), 19 deletions(-) (limited to 'servers/audio/effects') diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp index c81efc55e2..7bb62bcbed 100644 --- a/servers/audio/effects/audio_effect_stereo_enhance.cpp +++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp @@ -29,7 +29,9 @@ /*************************************************************************/ #include "audio_effect_stereo_enhance.h" + #include "servers/audio_server.h" + void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { float intensity = base->pan_pullout; bool surround_mode = base->surround > 0; @@ -140,8 +142,4 @@ void AudioEffectStereoEnhance::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "surround", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_surround", "get_surround"); } -AudioEffectStereoEnhance::AudioEffectStereoEnhance() { - pan_pullout = 1; - time_pullout = 0; - surround = 0; -} +AudioEffectStereoEnhance::AudioEffectStereoEnhance() {} diff --git a/servers/audio/effects/audio_effect_stereo_enhance.h b/servers/audio/effects/audio_effect_stereo_enhance.h index 1f93d1cf9f..30ea11f625 100644 --- a/servers/audio/effects/audio_effect_stereo_enhance.h +++ b/servers/audio/effects/audio_effect_stereo_enhance.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef AUDIOEFFECTSTEREOENHANCE_H -#define AUDIOEFFECTSTEREOENHANCE_H +#ifndef AUDIO_EFFECT_STEREO_ENHANCE_H +#define AUDIO_EFFECT_STEREO_ENHANCE_H #include "servers/audio/audio_effect.h" @@ -45,8 +45,8 @@ class AudioEffectStereoEnhanceInstance : public AudioEffectInstance { }; float *delay_ringbuff = nullptr; - unsigned int ringbuff_pos; - unsigned int ringbuff_mask; + unsigned int ringbuff_pos = 0; + unsigned int ringbuff_mask = 0; public: virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) override; @@ -58,11 +58,11 @@ class AudioEffectStereoEnhance : public AudioEffect { GDCLASS(AudioEffectStereoEnhance, AudioEffect); friend class AudioEffectStereoEnhanceInstance; - float volume_db; + float volume_db = 0.0f; - float pan_pullout; - float time_pullout; - float surround; + float pan_pullout = 1.0f; + float time_pullout = 0.0f; + float surround = 0.0f; protected: static void _bind_methods(); @@ -82,4 +82,4 @@ public: AudioEffectStereoEnhance(); }; -#endif // AUDIOEFFECTSTEREOENHANCE_H +#endif // AUDIO_EFFECT_STEREO_ENHANCE_H diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp index 4b5b9ab79f..adfd648514 100644 --- a/servers/audio/effects/reverb.cpp +++ b/servers/audio/effects/reverb.cpp @@ -28,8 +28,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -// Author: Juan Linietsky , (C) 2006 - #include "reverb.h" #include "core/math/math_funcs.h" diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h index de25e8c52b..c9602c5b5a 100644 --- a/servers/audio/effects/reverb.h +++ b/servers/audio/effects/reverb.h @@ -77,10 +77,11 @@ private: AllPass allpass[MAX_ALLPASS]; float *input_buffer = nullptr; float *echo_buffer = nullptr; - int echo_buffer_size; - int echo_buffer_pos; + int echo_buffer_size = 0; + int echo_buffer_pos = 0; - float hpf_h1, hpf_h2 = 0; + float hpf_h1 = 0.0f; + float hpf_h2 = 0.0f; struct Parameters { float room_size; -- cgit v1.2.3