diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2020-04-03 05:50:40 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-01-09 03:47:14 -0500 |
commit | 1d5042c9e265219dec8da7311879f12ef3ef698b (patch) | |
tree | 9456ab509bbcaf26cad8dca32dbe18a3cca9277d /servers/audio/effects/audio_effect_phaser.cpp | |
parent | 98ccaa1bad97bdb83b2afd6a4df6f7a392745592 (diff) | |
download | redot-engine-1d5042c9e265219dec8da7311879f12ef3ef698b.tar.gz |
Use Math_TAU and deg2rad/rad2deg in more places and optimize code
Diffstat (limited to 'servers/audio/effects/audio_effect_phaser.cpp')
-rw-r--r-- | servers/audio/effects/audio_effect_phaser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp index 5e4e183ccf..9b70f03a19 100644 --- a/servers/audio/effects/audio_effect_phaser.cpp +++ b/servers/audio/effects/audio_effect_phaser.cpp @@ -38,13 +38,13 @@ void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFra float dmin = base->range_min / (sampling_rate / 2.0); float dmax = base->range_max / (sampling_rate / 2.0); - float increment = 2.f * Math_PI * (base->rate / sampling_rate); + float increment = Math_TAU * (base->rate / sampling_rate); for (int i = 0; i < p_frame_count; i++) { phase += increment; - while (phase >= Math_PI * 2.f) { - phase -= Math_PI * 2.f; + while (phase >= Math_TAU) { + phase -= Math_TAU; } float d = dmin + (dmax - dmin) * ((sin(phase) + 1.f) / 2.f); |