summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_effect.h5
-rw-r--r--servers/audio/audio_stream.h14
-rw-r--r--servers/audio/effects/audio_effect_amplify.h4
-rw-r--r--servers/audio/effects/audio_effect_chorus.h4
-rw-r--r--servers/audio/effects/audio_effect_compressor.h4
-rw-r--r--servers/audio/effects/audio_effect_delay.h4
-rw-r--r--servers/audio/effects/audio_effect_distortion.h5
-rw-r--r--servers/audio/effects/audio_effect_eq.h13
-rw-r--r--servers/audio/effects/audio_effect_filter.h23
-rw-r--r--servers/audio/effects/audio_effect_limiter.h4
-rw-r--r--servers/audio/effects/audio_effect_panner.h4
-rw-r--r--servers/audio/effects/audio_effect_phaser.h4
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp42
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.h26
-rw-r--r--servers/audio/effects/audio_effect_record.h4
-rw-r--r--servers/audio/effects/audio_effect_reverb.h4
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.cpp5
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.h5
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.h4
-rw-r--r--servers/audio/effects/audio_stream_generator.h4
20 files changed, 126 insertions, 56 deletions
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h
index 1274e06740..8ae716db20 100644
--- a/servers/audio/audio_effect.h
+++ b/servers/audio/audio_effect.h
@@ -35,7 +35,7 @@
#include "core/resource.h"
class AudioEffectInstance : public Reference {
- GDCLASS(AudioEffectInstance, Reference)
+ GDCLASS(AudioEffectInstance, Reference);
public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) = 0;
@@ -43,7 +43,8 @@ public:
};
class AudioEffect : public Resource {
- GDCLASS(AudioEffect, Resource)
+ GDCLASS(AudioEffect, Resource);
+
public:
virtual Ref<AudioEffectInstance> instance() = 0;
AudioEffect();
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index ab4ef5f91b..8f023c0401 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -38,7 +38,7 @@
class AudioStreamPlayback : public Reference {
- GDCLASS(AudioStreamPlayback, Reference)
+ GDCLASS(AudioStreamPlayback, Reference);
public:
virtual void start(float p_from_pos = 0.0) = 0;
@@ -55,7 +55,7 @@ public:
class AudioStreamPlaybackResampled : public AudioStreamPlayback {
- GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback);
enum {
FP_BITS = 16, //fixed point used for resampling
@@ -81,7 +81,7 @@ public:
class AudioStream : public Resource {
- GDCLASS(AudioStream, Resource)
+ GDCLASS(AudioStream, Resource);
OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged
protected:
@@ -100,7 +100,7 @@ class AudioStreamPlaybackMicrophone;
class AudioStreamMicrophone : public AudioStream {
- GDCLASS(AudioStreamMicrophone, AudioStream)
+ GDCLASS(AudioStreamMicrophone, AudioStream);
friend class AudioStreamPlaybackMicrophone;
Set<AudioStreamPlaybackMicrophone *> playbacks;
@@ -119,7 +119,7 @@ public:
class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
- GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback);
friend class AudioStreamMicrophone;
bool active;
@@ -153,7 +153,7 @@ class AudioStreamPlaybackRandomPitch;
class AudioStreamRandomPitch : public AudioStream {
- GDCLASS(AudioStreamRandomPitch, AudioStream)
+ GDCLASS(AudioStreamRandomPitch, AudioStream);
friend class AudioStreamPlaybackRandomPitch;
Set<AudioStreamPlaybackRandomPitch *> playbacks;
@@ -180,7 +180,7 @@ public:
class AudioStreamPlaybackRandomPitch : public AudioStreamPlayback {
- GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback);
friend class AudioStreamRandomPitch;
Ref<AudioStreamRandomPitch> random_pitch;
diff --git a/servers/audio/effects/audio_effect_amplify.h b/servers/audio/effects/audio_effect_amplify.h
index b6e2a1d4d8..4a98196d94 100644
--- a/servers/audio/effects/audio_effect_amplify.h
+++ b/servers/audio/effects/audio_effect_amplify.h
@@ -36,7 +36,7 @@
class AudioEffectAmplify;
class AudioEffectAmplifyInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectAmplifyInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectAmplifyInstance, AudioEffectInstance);
friend class AudioEffectAmplify;
Ref<AudioEffectAmplify> base;
@@ -47,7 +47,7 @@ public:
};
class AudioEffectAmplify : public AudioEffect {
- GDCLASS(AudioEffectAmplify, AudioEffect)
+ GDCLASS(AudioEffectAmplify, AudioEffect);
friend class AudioEffectAmplifyInstance;
float volume_db;
diff --git a/servers/audio/effects/audio_effect_chorus.h b/servers/audio/effects/audio_effect_chorus.h
index 9cad2906ff..417cc0c035 100644
--- a/servers/audio/effects/audio_effect_chorus.h
+++ b/servers/audio/effects/audio_effect_chorus.h
@@ -36,7 +36,7 @@
class AudioEffectChorus;
class AudioEffectChorusInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectChorusInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectChorusInstance, AudioEffectInstance);
friend class AudioEffectChorus;
Ref<AudioEffectChorus> base;
@@ -54,7 +54,7 @@ public:
};
class AudioEffectChorus : public AudioEffect {
- GDCLASS(AudioEffectChorus, AudioEffect)
+ GDCLASS(AudioEffectChorus, AudioEffect);
friend class AudioEffectChorusInstance;
diff --git a/servers/audio/effects/audio_effect_compressor.h b/servers/audio/effects/audio_effect_compressor.h
index 3ea3a58cb2..0fe956f60b 100644
--- a/servers/audio/effects/audio_effect_compressor.h
+++ b/servers/audio/effects/audio_effect_compressor.h
@@ -36,7 +36,7 @@
class AudioEffectCompressor;
class AudioEffectCompressorInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectCompressorInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectCompressorInstance, AudioEffectInstance);
friend class AudioEffectCompressor;
Ref<AudioEffectCompressor> base;
@@ -49,7 +49,7 @@ public:
};
class AudioEffectCompressor : public AudioEffect {
- GDCLASS(AudioEffectCompressor, AudioEffect)
+ GDCLASS(AudioEffectCompressor, AudioEffect);
friend class AudioEffectCompressorInstance;
float threshold;
diff --git a/servers/audio/effects/audio_effect_delay.h b/servers/audio/effects/audio_effect_delay.h
index 131b8714a0..ee778c70dc 100644
--- a/servers/audio/effects/audio_effect_delay.h
+++ b/servers/audio/effects/audio_effect_delay.h
@@ -36,7 +36,7 @@
class AudioEffectDelay;
class AudioEffectDelayInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectDelayInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectDelayInstance, AudioEffectInstance);
friend class AudioEffectDelay;
Ref<AudioEffectDelay> base;
@@ -58,7 +58,7 @@ public:
};
class AudioEffectDelay : public AudioEffect {
- GDCLASS(AudioEffectDelay, AudioEffect)
+ GDCLASS(AudioEffectDelay, AudioEffect);
friend class AudioEffectDelayInstance;
enum {
diff --git a/servers/audio/effects/audio_effect_distortion.h b/servers/audio/effects/audio_effect_distortion.h
index 2cbffc81a1..0b5ad0ec9e 100644
--- a/servers/audio/effects/audio_effect_distortion.h
+++ b/servers/audio/effects/audio_effect_distortion.h
@@ -36,7 +36,7 @@
class AudioEffectDistortion;
class AudioEffectDistortionInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectDistortionInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectDistortionInstance, AudioEffectInstance);
friend class AudioEffectDistortion;
Ref<AudioEffectDistortion> base;
float h[2];
@@ -46,7 +46,8 @@ public:
};
class AudioEffectDistortion : public AudioEffect {
- GDCLASS(AudioEffectDistortion, AudioEffect)
+ GDCLASS(AudioEffectDistortion, AudioEffect);
+
public:
enum Mode {
MODE_CLIP,
diff --git a/servers/audio/effects/audio_effect_eq.h b/servers/audio/effects/audio_effect_eq.h
index c9735b9073..dc75e566e7 100644
--- a/servers/audio/effects/audio_effect_eq.h
+++ b/servers/audio/effects/audio_effect_eq.h
@@ -37,7 +37,7 @@
class AudioEffectEQ;
class AudioEffectEQInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectEQInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectEQInstance, AudioEffectInstance);
friend class AudioEffectEQ;
Ref<AudioEffectEQ> base;
@@ -49,7 +49,7 @@ public:
};
class AudioEffectEQ : public AudioEffect {
- GDCLASS(AudioEffectEQ, AudioEffect)
+ GDCLASS(AudioEffectEQ, AudioEffect);
friend class AudioEffectEQInstance;
@@ -75,21 +75,24 @@ public:
};
class AudioEffectEQ6 : public AudioEffectEQ {
- GDCLASS(AudioEffectEQ6, AudioEffectEQ)
+ GDCLASS(AudioEffectEQ6, AudioEffectEQ);
+
public:
AudioEffectEQ6() :
AudioEffectEQ(EQ::PRESET_6_BANDS) {}
};
class AudioEffectEQ10 : public AudioEffectEQ {
- GDCLASS(AudioEffectEQ10, AudioEffectEQ)
+ GDCLASS(AudioEffectEQ10, AudioEffectEQ);
+
public:
AudioEffectEQ10() :
AudioEffectEQ(EQ::PRESET_10_BANDS) {}
};
class AudioEffectEQ21 : public AudioEffectEQ {
- GDCLASS(AudioEffectEQ21, AudioEffectEQ)
+ GDCLASS(AudioEffectEQ21, AudioEffectEQ);
+
public:
AudioEffectEQ21() :
AudioEffectEQ(EQ::PRESET_21_BANDS) {}
diff --git a/servers/audio/effects/audio_effect_filter.h b/servers/audio/effects/audio_effect_filter.h
index fd9a4bcf07..bb0d451522 100644
--- a/servers/audio/effects/audio_effect_filter.h
+++ b/servers/audio/effects/audio_effect_filter.h
@@ -37,7 +37,7 @@
class AudioEffectFilter;
class AudioEffectFilterInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectFilterInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectFilterInstance, AudioEffectInstance);
friend class AudioEffectFilter;
Ref<AudioEffectFilter> base;
@@ -55,7 +55,8 @@ public:
};
class AudioEffectFilter : public AudioEffect {
- GDCLASS(AudioEffectFilter, AudioEffect)
+ GDCLASS(AudioEffectFilter, AudioEffect);
+
public:
enum FilterDB {
FILTER_6DB,
@@ -95,7 +96,7 @@ public:
VARIANT_ENUM_CAST(AudioEffectFilter::FilterDB)
class AudioEffectLowPassFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const {
if (property.name == "gain") property.usage = 0;
@@ -107,7 +108,7 @@ public:
};
class AudioEffectHighPassFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const {
if (property.name == "gain") property.usage = 0;
}
@@ -118,7 +119,7 @@ public:
};
class AudioEffectBandPassFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const {
if (property.name == "gain") property.usage = 0;
}
@@ -129,28 +130,32 @@ public:
};
class AudioEffectNotchFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectNotchFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectNotchFilter, AudioEffectFilter);
+
public:
AudioEffectNotchFilter() :
AudioEffectFilter(AudioFilterSW::NOTCH) {}
};
class AudioEffectBandLimitFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectBandLimitFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectBandLimitFilter, AudioEffectFilter);
+
public:
AudioEffectBandLimitFilter() :
AudioEffectFilter(AudioFilterSW::BANDLIMIT) {}
};
class AudioEffectLowShelfFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectLowShelfFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectLowShelfFilter, AudioEffectFilter);
+
public:
AudioEffectLowShelfFilter() :
AudioEffectFilter(AudioFilterSW::LOWSHELF) {}
};
class AudioEffectHighShelfFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectHighShelfFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectHighShelfFilter, AudioEffectFilter);
+
public:
AudioEffectHighShelfFilter() :
AudioEffectFilter(AudioFilterSW::HIGHSHELF) {}
diff --git a/servers/audio/effects/audio_effect_limiter.h b/servers/audio/effects/audio_effect_limiter.h
index d629166f42..bf7167e3f4 100644
--- a/servers/audio/effects/audio_effect_limiter.h
+++ b/servers/audio/effects/audio_effect_limiter.h
@@ -36,7 +36,7 @@
class AudioEffectLimiter;
class AudioEffectLimiterInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectLimiterInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectLimiterInstance, AudioEffectInstance);
friend class AudioEffectLimiter;
Ref<AudioEffectLimiter> base;
@@ -47,7 +47,7 @@ public:
};
class AudioEffectLimiter : public AudioEffect {
- GDCLASS(AudioEffectLimiter, AudioEffect)
+ GDCLASS(AudioEffectLimiter, AudioEffect);
friend class AudioEffectLimiterInstance;
float threshold;
diff --git a/servers/audio/effects/audio_effect_panner.h b/servers/audio/effects/audio_effect_panner.h
index 4256d05a2f..7bd5a09fc6 100644
--- a/servers/audio/effects/audio_effect_panner.h
+++ b/servers/audio/effects/audio_effect_panner.h
@@ -36,7 +36,7 @@
class AudioEffectPanner;
class AudioEffectPannerInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectPannerInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectPannerInstance, AudioEffectInstance);
friend class AudioEffectPanner;
Ref<AudioEffectPanner> base;
@@ -45,7 +45,7 @@ public:
};
class AudioEffectPanner : public AudioEffect {
- GDCLASS(AudioEffectPanner, AudioEffect)
+ GDCLASS(AudioEffectPanner, AudioEffect);
friend class AudioEffectPannerInstance;
float pan;
diff --git a/servers/audio/effects/audio_effect_phaser.h b/servers/audio/effects/audio_effect_phaser.h
index 264e792be5..b76d6bb29c 100644
--- a/servers/audio/effects/audio_effect_phaser.h
+++ b/servers/audio/effects/audio_effect_phaser.h
@@ -36,7 +36,7 @@
class AudioEffectPhaser;
class AudioEffectPhaserInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectPhaserInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectPhaserInstance, AudioEffectInstance);
friend class AudioEffectPhaser;
Ref<AudioEffectPhaser> base;
@@ -70,7 +70,7 @@ public:
};
class AudioEffectPhaser : public AudioEffect {
- GDCLASS(AudioEffectPhaser, AudioEffect)
+ GDCLASS(AudioEffectPhaser, AudioEffect);
friend class AudioEffectPhaserInstance;
float range_min;
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index ca2a88f858..c250f2e2bd 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -293,14 +293,16 @@ void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames, Audi
float *out_l = (float *)p_dst_frames;
float *out_r = out_l + 1;
- shift_l.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_l, out_l, 2);
- shift_r.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_r, out_r, 2);
+ shift_l.PitchShift(base->pitch_scale, p_frame_count, fft_size, base->oversampling, sample_rate, in_l, out_l, 2);
+ shift_r.PitchShift(base->pitch_scale, p_frame_count, fft_size, base->oversampling, sample_rate, in_r, out_r, 2);
}
Ref<AudioEffectInstance> AudioEffectPitchShift::instance() {
Ref<AudioEffectPitchShiftInstance> ins;
ins.instance();
ins->base = Ref<AudioEffectPitchShift>(this);
+ static const int fft_sizes[FFT_SIZE_MAX] = { 256, 512, 1024, 2048, 4096 };
+ ins->fft_size = fft_sizes[fft_size];
return ins;
}
@@ -315,14 +317,50 @@ float AudioEffectPitchShift::get_pitch_scale() const {
return pitch_scale;
}
+void AudioEffectPitchShift::set_oversampling(int p_oversampling) {
+ ERR_FAIL_COND(p_oversampling < 4);
+ oversampling = p_oversampling;
+}
+
+int AudioEffectPitchShift::get_oversampling() const {
+
+ return oversampling;
+}
+
+void AudioEffectPitchShift::set_fft_size(FFT_Size p_fft_size) {
+ ERR_FAIL_INDEX(p_fft_size, FFT_SIZE_MAX);
+ fft_size = p_fft_size;
+}
+
+AudioEffectPitchShift::FFT_Size AudioEffectPitchShift::get_fft_size() const {
+ return fft_size;
+}
+
void AudioEffectPitchShift::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pitch_scale", "rate"), &AudioEffectPitchShift::set_pitch_scale);
ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioEffectPitchShift::get_pitch_scale);
+ ClassDB::bind_method(D_METHOD("set_oversampling", "amount"), &AudioEffectPitchShift::set_oversampling);
+ ClassDB::bind_method(D_METHOD("get_oversampling"), &AudioEffectPitchShift::get_oversampling);
+
+ ClassDB::bind_method(D_METHOD("set_fft_size", "size"), &AudioEffectPitchShift::set_fft_size);
+ ClassDB::bind_method(D_METHOD("get_fft_size"), &AudioEffectPitchShift::get_fft_size);
+
ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_pitch_scale", "get_pitch_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "oversampling", PROPERTY_HINT_RANGE, "4,32,1"), "set_oversampling", "get_oversampling");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "fft_size", PROPERTY_HINT_ENUM, "256,512,1024,2048,4096"), "set_fft_size", "get_fft_size");
+
+ BIND_ENUM_CONSTANT(FFT_SIZE_256);
+ BIND_ENUM_CONSTANT(FFT_SIZE_512);
+ BIND_ENUM_CONSTANT(FFT_SIZE_1024);
+ BIND_ENUM_CONSTANT(FFT_SIZE_2048);
+ BIND_ENUM_CONSTANT(FFT_SIZE_4096);
+ BIND_ENUM_CONSTANT(FFT_SIZE_MAX);
}
AudioEffectPitchShift::AudioEffectPitchShift() {
pitch_scale = 1.0;
+ oversampling = 4;
+ fft_size = FFT_SIZE_2048;
}
diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h
index febc20e9d5..2028496ebf 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.h
+++ b/servers/audio/effects/audio_effect_pitch_shift.h
@@ -72,10 +72,11 @@ public:
class AudioEffectPitchShift;
class AudioEffectPitchShiftInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectPitchShiftInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectPitchShiftInstance, AudioEffectInstance);
friend class AudioEffectPitchShift;
Ref<AudioEffectPitchShift> base;
+ int fft_size;
SMBPitchShift shift_l;
SMBPitchShift shift_r;
@@ -84,12 +85,23 @@ public:
};
class AudioEffectPitchShift : public AudioEffect {
- GDCLASS(AudioEffectPitchShift, AudioEffect)
+ GDCLASS(AudioEffectPitchShift, AudioEffect);
+public:
friend class AudioEffectPitchShiftInstance;
+ enum FFT_Size {
+ FFT_SIZE_256,
+ FFT_SIZE_512,
+ FFT_SIZE_1024,
+ FFT_SIZE_2048,
+ FFT_SIZE_4096,
+ FFT_SIZE_MAX
+ };
+
float pitch_scale;
- int window_size;
+ int oversampling;
+ FFT_Size fft_size;
float wet;
float dry;
bool filter;
@@ -103,7 +115,15 @@ public:
void set_pitch_scale(float p_pitch_scale);
float get_pitch_scale() const;
+ void set_oversampling(int p_oversampling);
+ int get_oversampling() const;
+
+ void set_fft_size(FFT_Size);
+ FFT_Size get_fft_size() const;
+
AudioEffectPitchShift();
};
+VARIANT_ENUM_CAST(AudioEffectPitchShift::FFT_Size);
+
#endif // AUDIO_EFFECT_PITCH_SHIFT_H
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h
index 528c7dbd7c..d9bf39eb5f 100644
--- a/servers/audio/effects/audio_effect_record.h
+++ b/servers/audio/effects/audio_effect_record.h
@@ -43,7 +43,7 @@
class AudioEffectRecord;
class AudioEffectRecordInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectRecordInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectRecordInstance, AudioEffectInstance);
friend class AudioEffectRecord;
Ref<AudioEffectRecord> base;
@@ -77,7 +77,7 @@ public:
};
class AudioEffectRecord : public AudioEffect {
- GDCLASS(AudioEffectRecord, AudioEffect)
+ GDCLASS(AudioEffectRecord, AudioEffect);
friend class AudioEffectRecordInstance;
diff --git a/servers/audio/effects/audio_effect_reverb.h b/servers/audio/effects/audio_effect_reverb.h
index ed76050f24..31a796bf98 100644
--- a/servers/audio/effects/audio_effect_reverb.h
+++ b/servers/audio/effects/audio_effect_reverb.h
@@ -37,7 +37,7 @@
class AudioEffectReverb;
class AudioEffectReverbInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectReverbInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectReverbInstance, AudioEffectInstance);
Ref<AudioEffectReverb> base;
@@ -54,7 +54,7 @@ public:
};
class AudioEffectReverb : public AudioEffect {
- GDCLASS(AudioEffectReverb, AudioEffect)
+ GDCLASS(AudioEffectReverb, AudioEffect);
friend class AudioEffectReverbInstance;
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
index f5ac0afefa..305f9046c3 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -111,9 +111,10 @@ 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
- fftw[(i + temporal_fft_pos) * 2] = p_src_frames[i].l;
+ 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] = p_src_frames[i].r;
+ 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;
}
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.h b/servers/audio/effects/audio_effect_spectrum_analyzer.h
index 4f4c3c8a58..27eb88d29f 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.h
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.h
@@ -36,7 +36,7 @@
class AudioEffectSpectrumAnalyzer;
class AudioEffectSpectrumAnalyzerInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectSpectrumAnalyzerInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectSpectrumAnalyzerInstance, AudioEffectInstance);
public:
enum MagnitudeMode {
@@ -68,7 +68,8 @@ public:
VARIANT_ENUM_CAST(AudioEffectSpectrumAnalyzerInstance::MagnitudeMode)
class AudioEffectSpectrumAnalyzer : public AudioEffect {
- GDCLASS(AudioEffectSpectrumAnalyzer, AudioEffect)
+ GDCLASS(AudioEffectSpectrumAnalyzer, AudioEffect);
+
public:
enum FFT_Size {
FFT_SIZE_256,
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.h b/servers/audio/effects/audio_effect_stereo_enhance.h
index 787c351a03..44b7d3eb5c 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.h
+++ b/servers/audio/effects/audio_effect_stereo_enhance.h
@@ -36,7 +36,7 @@
class AudioEffectStereoEnhance;
class AudioEffectStereoEnhanceInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectStereoEnhanceInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectStereoEnhanceInstance, AudioEffectInstance);
friend class AudioEffectStereoEnhance;
Ref<AudioEffectStereoEnhance> base;
@@ -56,7 +56,7 @@ public:
};
class AudioEffectStereoEnhance : public AudioEffect {
- GDCLASS(AudioEffectStereoEnhance, AudioEffect)
+ GDCLASS(AudioEffectStereoEnhance, AudioEffect);
friend class AudioEffectStereoEnhanceInstance;
float volume_db;
diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h
index c3490ddaa5..33839d3db8 100644
--- a/servers/audio/effects/audio_stream_generator.h
+++ b/servers/audio/effects/audio_stream_generator.h
@@ -35,7 +35,7 @@
#include "servers/audio/audio_stream.h"
class AudioStreamGenerator : public AudioStream {
- GDCLASS(AudioStreamGenerator, AudioStream)
+ GDCLASS(AudioStreamGenerator, AudioStream);
float mix_rate;
float buffer_len;
@@ -59,7 +59,7 @@ public:
class AudioStreamGeneratorPlayback : public AudioStreamPlaybackResampled {
- GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled)
+ GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled);
friend class AudioStreamGenerator;
RingBuffer<AudioFrame> buffer;
int skips;