diff options
Diffstat (limited to 'servers/audio/effects')
-rw-r--r-- | servers/audio/effects/audio_effect_spectrum_analyzer.cpp | 19 | ||||
-rw-r--r-- | servers/audio/effects/audio_stream_generator.h | 2 | ||||
-rw-r--r-- | servers/audio/effects/eq.cpp | 2 | ||||
-rw-r--r-- | servers/audio/effects/eq.h | 2 |
4 files changed, 12 insertions, 13 deletions
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp index e744dbf9b0..3f4f11ee8d 100644 --- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp +++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp @@ -113,15 +113,15 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames float *fftw = temporal_fft.ptrw(); for (int i = 0; i < to_fill; i++) { //left and right buffers - float window = -0.5 * Math::cos(2.0 * Math_PI * (double)i / (double)to_fill) + 0.5; - fftw[(i + temporal_fft_pos) * 2] = window * p_src_frames[i].l; - fftw[(i + temporal_fft_pos) * 2 + 1] = 0; - fftw[(i + temporal_fft_pos + fft_size * 2) * 2] = window * p_src_frames[i].r; - fftw[(i + temporal_fft_pos + fft_size * 2) * 2 + 1] = 0; + float window = -0.5 * Math::cos(2.0 * Math_PI * (double)temporal_fft_pos / (double)fft_size) + 0.5; + fftw[temporal_fft_pos * 2] = window * p_src_frames->l; + fftw[temporal_fft_pos * 2 + 1] = 0; + fftw[(temporal_fft_pos + fft_size * 2) * 2] = window * p_src_frames->r; + fftw[(temporal_fft_pos + fft_size * 2) * 2 + 1] = 0; + ++p_src_frames; + ++temporal_fft_pos; } - p_src_frames += to_fill; - temporal_fft_pos += to_fill; p_frame_count -= to_fill; if (temporal_fft_pos == fft_size * 2) { @@ -134,9 +134,8 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames for (int i = 0; i < fft_size; i++) { //abs(vec)/fft_size normalizes each frequency - float window = 1.0; //-.5 * Math::cos(2. * Math_PI * (double)i / (double)fft_size) + .5; - hw[i].l = window * Vector2(fftw[i * 2], fftw[i * 2 + 1]).length() / float(fft_size); - hw[i].r = window * Vector2(fftw[fft_size * 4 + i * 2], fftw[fft_size * 4 + i * 2 + 1]).length() / float(fft_size); + hw[i].l = Vector2(fftw[i * 2], fftw[i * 2 + 1]).length() / float(fft_size); + hw[i].r = Vector2(fftw[fft_size * 4 + i * 2], fftw[fft_size * 4 + i * 2 + 1]).length() / float(fft_size); } fft_pos = next; //swap diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h index c90983a66f..49bda0fcf9 100644 --- a/servers/audio/effects/audio_stream_generator.h +++ b/servers/audio/effects/audio_stream_generator.h @@ -31,7 +31,7 @@ #ifndef AUDIO_STREAM_GENERATOR_H #define AUDIO_STREAM_GENERATOR_H -#include "core/ring_buffer.h" +#include "core/templates/ring_buffer.h" #include "servers/audio/audio_stream.h" class AudioStreamGenerator : public AudioStream { diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp index 08a6cf55fa..15abeea5f3 100644 --- a/servers/audio/effects/eq.cpp +++ b/servers/audio/effects/eq.cpp @@ -31,7 +31,7 @@ // Author: reduzio@gmail.com (C) 2006 #include "eq.h" -#include "core/error_macros.h" +#include "core/error/error_macros.h" #include "core/math/math_funcs.h" #include <math.h> diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h index 391a7aa24b..720c4dfcaf 100644 --- a/servers/audio/effects/eq.h +++ b/servers/audio/effects/eq.h @@ -33,8 +33,8 @@ #ifndef EQ_FILTER_H #define EQ_FILTER_H +#include "core/templates/vector.h" #include "core/typedefs.h" -#include "core/vector.h" /** @author Juan Linietsky |