diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-29 09:18:07 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-29 10:38:21 +0300 |
commit | ea1848ce0a5f03c3a9f7e0a221350f4f4044bb08 (patch) | |
tree | fdbb5979dfe5f81a4d3e53ea71f625d84848e730 /servers/audio/effects | |
parent | f8745f2f71c79972df66f17a3da75f6e328bc55d (diff) |
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings.
Diffstat (limited to 'servers/audio/effects')
-rw-r--r-- | servers/audio/effects/audio_effect_filter.cpp | 12 | ||||
-rw-r--r-- | servers/audio/effects/audio_stream_generator.cpp | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/servers/audio/effects/audio_effect_filter.cpp b/servers/audio/effects/audio_effect_filter.cpp index a9409076cd..68f8e334df 100644 --- a/servers/audio/effects/audio_effect_filter.cpp +++ b/servers/audio/effects/audio_effect_filter.cpp @@ -36,13 +36,13 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames, for (int i = 0; i < p_frame_count; i++) { float f = p_src_frames[i].l; filter_process[0][0].process_one(f); - if (S > 1) { + if constexpr (S > 1) { filter_process[0][1].process_one(f); } - if (S > 2) { + if constexpr (S > 2) { filter_process[0][2].process_one(f); } - if (S > 3) { + if constexpr (S > 3) { filter_process[0][3].process_one(f); } @@ -52,13 +52,13 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames, for (int i = 0; i < p_frame_count; i++) { float f = p_src_frames[i].r; filter_process[1][0].process_one(f); - if (S > 1) { + if constexpr (S > 1) { filter_process[1][1].process_one(f); } - if (S > 2) { + if constexpr (S > 2) { filter_process[1][2].process_one(f); } - if (S > 3) { + if constexpr (S > 3) { filter_process[1][3].process_one(f); } diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index b5f772408d..547b60a317 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -108,7 +108,7 @@ bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frame } const Vector2 *r = p_frames.ptr(); - if (sizeof(real_t) == 4) { + if constexpr (sizeof(real_t) == 4) { //write directly buffer.write((const AudioFrame *)r, to_write); } else { |