diff options
Diffstat (limited to 'servers/audio/effects')
-rw-r--r-- | servers/audio/effects/SCsub | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_chorus.cpp | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_delay.cpp | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_distortion.cpp | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_filter.h | 13 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_phaser.cpp | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_pitch_shift.cpp | 8 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_pitch_shift.h | 2 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_record.cpp | 4 | ||||
-rw-r--r-- | servers/audio/effects/audio_effect_record.h | 13 | ||||
-rw-r--r-- | servers/audio/effects/eq.cpp | 4 | ||||
-rw-r--r-- | servers/audio/effects/eq.h | 4 | ||||
-rw-r--r-- | servers/audio/effects/reverb.cpp | 26 | ||||
-rw-r--r-- | servers/audio/effects/reverb.h | 6 |
14 files changed, 52 insertions, 38 deletions
diff --git a/servers/audio/effects/SCsub b/servers/audio/effects/SCsub index ccc76e823f..d730144861 100644 --- a/servers/audio/effects/SCsub +++ b/servers/audio/effects/SCsub @@ -3,5 +3,3 @@ Import('env') env.add_source_files(env.servers_sources, "*.cpp") - -Export('env') diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp index fd9e3311e7..3c88d050f6 100644 --- a/servers/audio/effects/audio_effect_chorus.cpp +++ b/servers/audio/effects/audio_effect_chorus.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_effect_chorus.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #include "servers/audio_server.h" void AudioEffectChorusInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { diff --git a/servers/audio/effects/audio_effect_delay.cpp b/servers/audio/effects/audio_effect_delay.cpp index e3af898afa..abc10ee096 100644 --- a/servers/audio/effects/audio_effect_delay.cpp +++ b/servers/audio/effects/audio_effect_delay.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_effect_delay.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #include "servers/audio_server.h" void AudioEffectDelayInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { diff --git a/servers/audio/effects/audio_effect_distortion.cpp b/servers/audio/effects/audio_effect_distortion.cpp index c9ac0db644..0422083363 100644 --- a/servers/audio/effects/audio_effect_distortion.cpp +++ b/servers/audio/effects/audio_effect_distortion.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_effect_distortion.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #include "servers/audio_server.h" void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { diff --git a/servers/audio/effects/audio_effect_filter.h b/servers/audio/effects/audio_effect_filter.h index 11978882bc..e8f12e5efa 100644 --- a/servers/audio/effects/audio_effect_filter.h +++ b/servers/audio/effects/audio_effect_filter.h @@ -96,6 +96,11 @@ VARIANT_ENUM_CAST(AudioEffectFilter::FilterDB) class AudioEffectLowPassFilter : public AudioEffectFilter { GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter) + + void _validate_property(PropertyInfo &property) const { + if (property.name == "gain") property.usage = 0; + } + public: AudioEffectLowPassFilter() : AudioEffectFilter(AudioFilterSW::LOWPASS) {} @@ -103,6 +108,10 @@ public: class AudioEffectHighPassFilter : public AudioEffectFilter { GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter) + void _validate_property(PropertyInfo &property) const { + if (property.name == "gain") property.usage = 0; + } + public: AudioEffectHighPassFilter() : AudioEffectFilter(AudioFilterSW::HIGHPASS) {} @@ -110,6 +119,10 @@ public: class AudioEffectBandPassFilter : public AudioEffectFilter { GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter) + void _validate_property(PropertyInfo &property) const { + if (property.name == "gain") property.usage = 0; + } + public: AudioEffectBandPassFilter() : AudioEffectFilter(AudioFilterSW::BANDPASS) {} diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp index c0a9bd773d..3151111ec8 100644 --- a/servers/audio/effects/audio_effect_phaser.cpp +++ b/servers/audio/effects/audio_effect_phaser.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_effect_phaser.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #include "servers/audio_server.h" void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index ddd0a0db6b..f5ca8f2da4 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -30,7 +30,7 @@ #include "audio_effect_pitch_shift.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #include "servers/audio_server.h" /* Thirdparty code, so disable clang-format with Godot style */ @@ -305,9 +305,9 @@ Ref<AudioEffectInstance> AudioEffectPitchShift::instance() { return ins; } -void AudioEffectPitchShift::set_pitch_scale(float p_adjust) { - - pitch_scale = p_adjust; +void AudioEffectPitchShift::set_pitch_scale(float p_pitch_scale) { + ERR_FAIL_COND(p_pitch_scale <= 0.0); + pitch_scale = p_pitch_scale; } float AudioEffectPitchShift::get_pitch_scale() const { diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h index f1c78d752f..78f92a0261 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.h +++ b/servers/audio/effects/audio_effect_pitch_shift.h @@ -100,7 +100,7 @@ protected: public: Ref<AudioEffectInstance> instance(); - void set_pitch_scale(float p_adjust); + void set_pitch_scale(float p_pitch_scale); float get_pitch_scale() const; AudioEffectPitchShift(); diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index 74a6838d1a..a0094f66b8 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -44,7 +44,7 @@ void AudioEffectRecordInstance::process(const AudioFrame *p_src_frames, AudioFra } } -bool AudioEffectRecordInstance::process_silence() { +bool AudioEffectRecordInstance::process_silence() const { return true; } @@ -233,7 +233,7 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const { w[i * 2 + 1] = rr[i]; } } else { - ERR_EXPLAIN("format not implemented"); + ERR_PRINT("Format not implemented."); } Ref<AudioStreamSample> sample; diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h index e4f5ba8a23..4b8ee2bcdd 100644 --- a/servers/audio/effects/audio_effect_record.h +++ b/servers/audio/effects/audio_effect_record.h @@ -31,11 +31,11 @@ #ifndef AUDIOEFFECTRECORD_H #define AUDIOEFFECTRECORD_H +#include "core/io/marshalls.h" +#include "core/os/file_access.h" +#include "core/os/os.h" #include "core/os/thread.h" #include "editor/import/resource_importer_wav.h" -#include "io/marshalls.h" -#include "os/file_access.h" -#include "os/os.h" #include "scene/resources/audio_stream_sample.h" #include "servers/audio/audio_effect.h" #include "servers/audio_server.h" @@ -49,7 +49,7 @@ class AudioEffectRecordInstance : public AudioEffectInstance { bool is_recording; Thread *io_thread; - bool thread_active = false; + bool thread_active; Vector<AudioFrame> ring_buffer; Vector<float> recording_data; @@ -66,7 +66,10 @@ class AudioEffectRecordInstance : public AudioEffectInstance { public: void init(); virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count); - virtual bool process_silence(); + virtual bool process_silence() const; + + AudioEffectRecordInstance() : + thread_active(false) {} }; class AudioEffectRecord : public AudioEffect { diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp index b15fc7ecf4..70ac70a5a8 100644 --- a/servers/audio/effects/eq.cpp +++ b/servers/audio/effects/eq.cpp @@ -31,8 +31,8 @@ // Author: reduzio@gmail.com (C) 2006 #include "eq.h" -#include "error_macros.h" -#include "math_funcs.h" +#include "core/error_macros.h" +#include "core/math/math_funcs.h" #include <math.h> #define POW2(v) ((v) * (v)) diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h index 5c654529c3..c06f1f8bf8 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 "typedefs.h" -#include "vector.h" +#include "core/typedefs.h" +#include "core/vector.h" /** @author Juan Linietsky diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp index 5e31202e58..b032c91da2 100644 --- a/servers/audio/effects/reverb.cpp +++ b/servers/audio/effects/reverb.cpp @@ -31,27 +31,27 @@ // Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006 #include "reverb.h" -#include "math_funcs.h" +#include "core/math/math_funcs.h" #include <math.h> const float Reverb::comb_tunings[MAX_COMBS] = { //freeverb comb tunings - 0.025306122448979593, - 0.026938775510204082, - 0.028956916099773241, - 0.03074829931972789, - 0.032244897959183672, - 0.03380952380952381, - 0.035306122448979592, - 0.036666666666666667 + 0.025306122448979593f, + 0.026938775510204082f, + 0.028956916099773241f, + 0.03074829931972789f, + 0.032244897959183672f, + 0.03380952380952381f, + 0.035306122448979592f, + 0.036666666666666667f }; const float Reverb::allpass_tunings[MAX_ALLPASS] = { //freeverb allpass tunings - 0.0051020408163265302, - 0.007732426303854875, - 0.01, - 0.012607709750566893 + 0.0051020408163265302f, + 0.007732426303854875f, + 0.01f, + 0.012607709750566893f }; void Reverb::process(float *p_src, float *p_dst, int p_frames) { diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h index c3d3873dcd..03cf197456 100644 --- a/servers/audio/effects/reverb.h +++ b/servers/audio/effects/reverb.h @@ -33,9 +33,9 @@ #ifndef REVERB_H #define REVERB_H -#include "audio_frame.h" -#include "os/memory.h" -#include "typedefs.h" +#include "core/math/audio_frame.h" +#include "core/os/memory.h" +#include "core/typedefs.h" class Reverb { public: |