summaryrefslogtreecommitdiffstats
path: root/servers/audio/effects/audio_effect_chorus.cpp
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2020-04-03 05:50:40 -0400
committerAaron Franke <arnfranke@yahoo.com>2021-01-09 03:47:14 -0500
commit1d5042c9e265219dec8da7311879f12ef3ef698b (patch)
tree9456ab509bbcaf26cad8dca32dbe18a3cca9277d /servers/audio/effects/audio_effect_chorus.cpp
parent98ccaa1bad97bdb83b2afd6a4df6f7a392745592 (diff)
downloadredot-engine-1d5042c9e265219dec8da7311879f12ef3ef698b.tar.gz
Use Math_TAU and deg2rad/rad2deg in more places and optimize code
Diffstat (limited to 'servers/audio/effects/audio_effect_chorus.cpp')
-rw-r--r--servers/audio/effects/audio_effect_chorus.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp
index 1542273a24..76a995eb37 100644
--- a/servers/audio/effects/audio_effect_chorus.cpp
+++ b/servers/audio/effects/audio_effect_chorus.cpp
@@ -84,7 +84,7 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A
if (v.cutoff == 0) {
continue;
}
- float auxlp = expf(-2.0 * Math_PI * v.cutoff / mix_rate);
+ float auxlp = expf(-Math_TAU * v.cutoff / mix_rate);
float c1 = 1.0 - auxlp;
float c2 = auxlp;
AudioFrame h = filter_h[vc];
@@ -104,7 +104,7 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A
float phase = (float)(local_cycles & AudioEffectChorus::CYCLES_MASK) / (float)(1 << AudioEffectChorus::CYCLES_FRAC);
- float wave_delay = sinf(phase * 2.0 * Math_PI) * max_depth_frames;
+ float wave_delay = sinf(phase * Math_TAU) * max_depth_frames;
int wave_delay_frames = lrint(floor(wave_delay));
float wave_delay_frac = wave_delay - (float)wave_delay_frames;