1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57:09 +00:00

Use constants from math_funcs rather than unstandardized C++ constants.

This commit is contained in:
Ray Koopa
2017-01-24 18:56:43 +01:00
parent 87bb6cdc6f
commit ad3e1a9067
7 changed files with 41 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
#include "audio_effect_phaser.h"
#include "servers/audio_server.h"
#include "math_funcs.h"
void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames,AudioFrame *p_dst_frames,int p_frame_count) {
@@ -8,14 +9,14 @@ void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames,AudioFram
float dmin = base->range_min / (sampling_rate/2.0);
float dmax = base->range_max / (sampling_rate/2.0);
float increment = 2.f * M_PI * (base->rate / sampling_rate);
float increment = 2.f * Math_PI * (base->rate / sampling_rate);
for(int i=0;i<p_frame_count;i++) {
phase += increment;
while ( phase >= M_PI * 2.f ) {
phase -= M_PI * 2.f;
while ( phase >= Math_PI * 2.f ) {
phase -= Math_PI * 2.f;
}
float d = dmin + (dmax-dmin) * ((sin( phase ) + 1.f)/2.f);