diff options
Diffstat (limited to 'servers/audio')
31 files changed, 0 insertions, 340 deletions
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp index ed67e8902a..5560385fd3 100644 --- a/servers/audio/audio_driver_dummy.cpp +++ b/servers/audio/audio_driver_dummy.cpp @@ -34,7 +34,6 @@ #include "core/project_settings.h" Error AudioDriverDummy::init() { - active = false; thread_exited = false; exit_thread = false; @@ -55,15 +54,12 @@ Error AudioDriverDummy::init() { }; void AudioDriverDummy::thread_func(void *p_udata) { - AudioDriverDummy *ad = (AudioDriverDummy *)p_udata; uint64_t usdelay = (ad->buffer_frames / float(ad->mix_rate)) * 1000000; while (!ad->exit_thread) { - if (ad->active) { - ad->lock(); ad->audio_server_process(ad->buffer_frames, ad->samples_in); @@ -78,36 +74,30 @@ void AudioDriverDummy::thread_func(void *p_udata) { }; void AudioDriverDummy::start() { - active = true; }; int AudioDriverDummy::get_mix_rate() const { - return mix_rate; }; AudioDriver::SpeakerMode AudioDriverDummy::get_speaker_mode() const { - return speaker_mode; }; void AudioDriverDummy::lock() { - if (!thread) return; mutex.lock(); }; void AudioDriverDummy::unlock() { - if (!thread) return; mutex.unlock(); }; void AudioDriverDummy::finish() { - if (!thread) return; @@ -123,7 +113,6 @@ void AudioDriverDummy::finish() { }; AudioDriverDummy::AudioDriverDummy() { - thread = nullptr; }; diff --git a/servers/audio/audio_driver_dummy.h b/servers/audio/audio_driver_dummy.h index a2cd9b2dc6..3cf31e8be6 100644 --- a/servers/audio/audio_driver_dummy.h +++ b/servers/audio/audio_driver_dummy.h @@ -37,7 +37,6 @@ #include "core/os/thread.h" class AudioDriverDummy : public AudioDriver { - Thread *thread; Mutex mutex; diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp index 3928ba1388..b4f3935f3a 100644 --- a/servers/audio/audio_filter_sw.cpp +++ b/servers/audio/audio_filter_sw.cpp @@ -31,30 +31,24 @@ #include "audio_filter_sw.h" void AudioFilterSW::set_mode(Mode p_mode) { - mode = p_mode; } void AudioFilterSW::set_cutoff(float p_cutoff) { - cutoff = p_cutoff; } void AudioFilterSW::set_resonance(float p_resonance) { - resonance = p_resonance; } void AudioFilterSW::set_gain(float p_gain) { - gain = p_gain; } void AudioFilterSW::set_sampling_rate(float p_srate) { - sampling_rate = p_srate; } void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { - int sr_limit = (sampling_rate / 2) + 512; double final_cutoff = (cutoff > sr_limit) ? sr_limit : cutoff; @@ -82,7 +76,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { tmpgain = 0.001; if (stages > 1) { - Q = (Q > 1.0 ? Math::pow(Q, 1.0 / stages) : Q); tmpgain = Math::pow(tmpgain, 1.0 / (stages + 1)); } @@ -91,9 +84,7 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { double a0 = 1.0 + alpha; switch (mode) { - case LOWPASS: { - p_coeffs->b0 = (1.0 - cos_v) / 2.0; p_coeffs->b1 = 1.0 - cos_v; p_coeffs->b2 = (1.0 - cos_v) / 2.0; @@ -102,7 +93,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { } break; case HIGHPASS: { - p_coeffs->b0 = (1.0 + cos_v) / 2.0; p_coeffs->b1 = -(1.0 + cos_v); p_coeffs->b2 = (1.0 + cos_v) / 2.0; @@ -111,7 +101,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { } break; case BANDPASS: { - p_coeffs->b0 = alpha * sqrt(Q + 1); p_coeffs->b1 = 0.0; p_coeffs->b2 = -alpha * sqrt(Q + 1); @@ -120,7 +109,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { } break; case NOTCH: { - p_coeffs->b0 = 1.0; p_coeffs->b1 = -2.0 * cos_v; p_coeffs->b2 = 1.0; @@ -151,7 +139,6 @@ void AudioFilterSW::prepare_coefficients(Coeffs *p_coeffs) { } break; case LOWSHELF: { - double tmpq = Math::sqrt(Q); if (tmpq <= 0) tmpq = 0.001; @@ -203,7 +190,6 @@ void AudioFilterSW::set_stages(int p_stages) { //adjust for multiple stages /* Fouriertransform kernel to obtain response */ float AudioFilterSW::get_response(float p_freq, Coeffs *p_coeffs) { - float freq = p_freq / sampling_rate * Math_PI * 2.0f; float cx = p_coeffs->b0, cy = 0.0; @@ -227,7 +213,6 @@ float AudioFilterSW::get_response(float p_freq, Coeffs *p_coeffs) { } AudioFilterSW::AudioFilterSW() { - sampling_rate = 44100; resonance = 0.5; cutoff = 5000; @@ -237,12 +222,10 @@ AudioFilterSW::AudioFilterSW() { } AudioFilterSW::Processor::Processor() { - set_filter(nullptr); } void AudioFilterSW::Processor::set_filter(AudioFilterSW *p_filter, bool p_clear_history) { - if (p_clear_history) { ha1 = ha2 = hb1 = hb2 = 0; } @@ -250,7 +233,6 @@ void AudioFilterSW::Processor::set_filter(AudioFilterSW *p_filter, bool p_clear_ } void AudioFilterSW::Processor::update_coeffs(int p_interp_buffer_len) { - if (!filter) return; @@ -269,19 +251,16 @@ void AudioFilterSW::Processor::update_coeffs(int p_interp_buffer_len) { } void AudioFilterSW::Processor::process(float *p_samples, int p_amount, int p_stride, bool p_interpolate) { - if (!filter) return; if (p_interpolate) { for (int i = 0; i < p_amount; i++) { - process_one_interp(*p_samples); p_samples += p_stride; } } else { for (int i = 0; i < p_amount; i++) { - process_one(*p_samples); p_samples += p_stride; } diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h index 61088eec55..a7f570fbb4 100644 --- a/servers/audio/audio_filter_sw.h +++ b/servers/audio/audio_filter_sw.h @@ -36,7 +36,6 @@ class AudioFilterSW { public: struct Coeffs { - float a1, a2; float b0, b1, b2; @@ -99,7 +98,6 @@ public: /* inline methods */ void AudioFilterSW::Processor::process_one(float &p_sample) { - float pre = p_sample; p_sample = (p_sample * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2); ha2 = ha1; @@ -109,7 +107,6 @@ void AudioFilterSW::Processor::process_one(float &p_sample) { } void AudioFilterSW::Processor::process_one_interp(float &p_sample) { - float pre = p_sample; p_sample = (p_sample * coeffs.b0 + hb1 * coeffs.b1 + hb2 * coeffs.b2 + ha1 * coeffs.a1 + ha2 * coeffs.a2); ha2 = ha1; diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp index 7097c3934f..a7542fab03 100644 --- a/servers/audio/audio_rb_resampler.cpp +++ b/servers/audio/audio_rb_resampler.cpp @@ -34,7 +34,6 @@ #include "servers/audio_server.h" int AudioRBResampler::get_channel_count() const { - if (!rb) return 0; @@ -46,11 +45,9 @@ int AudioRBResampler::get_channel_count() const { // but it wasn't obvious to integrate that with VideoPlayer template <int C> uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_increment) { - uint32_t read = offset & MIX_FRAC_MASK; for (int i = 0; i < p_todo; i++) { - offset = (offset + p_increment) & (((1 << (rb_bits + MIX_FRAC_BITS)) - 1)); read += p_increment; uint32_t pos = offset >> MIX_FRAC_BITS; @@ -60,7 +57,6 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i // since this is a template with a known compile time value (C), conditionals go away when compiling. if (C == 1) { - float v0 = rb[pos]; float v0n = rb[pos_next]; v0 += (v0n - v0) * frac; @@ -68,7 +64,6 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i } if (C == 2) { - float v0 = rb[(pos << 1) + 0]; float v1 = rb[(pos << 1) + 1]; float v0n = rb[(pos_next << 1) + 0]; @@ -81,7 +76,6 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i // This will probably never be used, but added anyway if (C == 4) { - float v0 = rb[(pos << 2) + 0]; float v1 = rb[(pos << 2) + 1]; float v0n = rb[(pos_next << 2) + 0]; @@ -92,7 +86,6 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i } if (C == 6) { - float v0 = rb[(pos * 6) + 0]; float v1 = rb[(pos * 6) + 1]; float v0n = rb[(pos_next * 6) + 0]; @@ -108,7 +101,6 @@ uint32_t AudioRBResampler::_resample(AudioFrame *p_dest, int p_todo, int32_t p_i } bool AudioRBResampler::mix(AudioFrame *p_dest, int p_frames) { - if (!rb) return false; @@ -163,7 +155,6 @@ int AudioRBResampler::get_num_of_ready_frames() { } Error AudioRBResampler::setup(int p_channels, int p_src_mix_rate, int p_target_mix_rate, int p_buffer_msec, int p_minbuff_needed) { - ERR_FAIL_COND_V(p_channels != 1 && p_channels != 2 && p_channels != 4 && p_channels != 6, ERR_INVALID_PARAMETER); int desired_rb_bits = nearest_shift(MAX((p_buffer_msec / 1000.0) * p_src_mix_rate, p_minbuff_needed)); @@ -171,14 +162,12 @@ Error AudioRBResampler::setup(int p_channels, int p_src_mix_rate, int p_target_m bool recreate = !rb; if (rb && (uint32_t(desired_rb_bits) != rb_bits || channels != uint32_t(p_channels))) { - memdelete_arr(rb); memdelete_arr(read_buf); recreate = true; } if (recreate) { - channels = p_channels; rb_bits = desired_rb_bits; rb_len = (1 << rb_bits); @@ -195,7 +184,6 @@ Error AudioRBResampler::setup(int p_channels, int p_src_mix_rate, int p_target_m //avoid maybe strange noises upon load for (unsigned int i = 0; i < (rb_len * channels); i++) { - rb[i] = 0; read_buf[i] = 0; } @@ -204,7 +192,6 @@ Error AudioRBResampler::setup(int p_channels, int p_src_mix_rate, int p_target_m } void AudioRBResampler::clear() { - if (!rb) return; @@ -219,7 +206,6 @@ void AudioRBResampler::clear() { } AudioRBResampler::AudioRBResampler() { - rb = nullptr; offset = 0; read_buf = nullptr; @@ -236,7 +222,6 @@ AudioRBResampler::AudioRBResampler() { } AudioRBResampler::~AudioRBResampler() { - if (rb) { memdelete_arr(rb); memdelete_arr(read_buf); diff --git a/servers/audio/audio_rb_resampler.h b/servers/audio/audio_rb_resampler.h index 40cf3e4cd7..12ec526adb 100644 --- a/servers/audio/audio_rb_resampler.h +++ b/servers/audio/audio_rb_resampler.h @@ -36,7 +36,6 @@ #include "servers/audio_server.h" struct AudioRBResampler { - uint32_t rb_bits; uint32_t rb_len; uint32_t rb_mask; @@ -116,31 +115,24 @@ public: _FORCE_INLINE_ float *get_write_buffer() { return read_buf; } _FORCE_INLINE_ void write(uint32_t p_frames) { - ERR_FAIL_COND(p_frames >= rb_len); switch (channels) { case 1: { - for (uint32_t i = 0; i < p_frames; i++) { - rb[rb_write_pos] = read_buf[i]; rb_write_pos = (rb_write_pos + 1) & rb_mask; } } break; case 2: { - for (uint32_t i = 0; i < p_frames; i++) { - rb[(rb_write_pos << 1) + 0] = read_buf[(i << 1) + 0]; rb[(rb_write_pos << 1) + 1] = read_buf[(i << 1) + 1]; rb_write_pos = (rb_write_pos + 1) & rb_mask; } } break; case 4: { - for (uint32_t i = 0; i < p_frames; i++) { - rb[(rb_write_pos << 2) + 0] = read_buf[(i << 2) + 0]; rb[(rb_write_pos << 2) + 1] = read_buf[(i << 2) + 1]; rb[(rb_write_pos << 2) + 2] = read_buf[(i << 2) + 2]; @@ -149,9 +141,7 @@ public: } } break; case 6: { - for (uint32_t i = 0; i < p_frames; i++) { - rb[(rb_write_pos * 6) + 0] = read_buf[(i * 6) + 0]; rb[(rb_write_pos * 6) + 1] = read_buf[(i * 6) + 1]; rb[(rb_write_pos * 6) + 2] = read_buf[(i * 6) + 2]; diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 46e674fd9b..b7e3f8964b 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -36,7 +36,6 @@ ////////////////////////////// void AudioStreamPlaybackResampled::_begin_resample() { - //clear cubic interpolation history internal_buffer[0] = AudioFrame(0.0, 0.0); internal_buffer[1] = AudioFrame(0.0, 0.0); @@ -48,14 +47,12 @@ void AudioStreamPlaybackResampled::_begin_resample() { } void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) { - float target_rate = AudioServer::get_singleton()->get_mix_rate(); float global_rate_scale = AudioServer::get_singleton()->get_global_rate_scale(); uint64_t mix_increment = uint64_t(((get_stream_sampling_rate() * p_rate_scale) / double(target_rate * global_rate_scale)) * double(FP_LEN)); for (int i = 0; i < p_frames; i++) { - uint32_t idx = CUBIC_INTERP_HISTORY + uint32_t(mix_offset >> FP_BITS); //standard cubic interpolation (great quality/performance ratio) //this used to be moved to a LUT for greater performance, but nowadays CPU speed is generally faster than memory. @@ -76,7 +73,6 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, mix_offset += mix_increment; while ((mix_offset >> FP_BITS) >= INTERNAL_BUFFER_LEN) { - internal_buffer[0] = internal_buffer[INTERNAL_BUFFER_LEN + 0]; internal_buffer[1] = internal_buffer[INTERNAL_BUFFER_LEN + 1]; internal_buffer[2] = internal_buffer[INTERNAL_BUFFER_LEN + 2]; @@ -97,7 +93,6 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, //////////////////////////////// void AudioStream::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_length"), &AudioStream::get_length); } @@ -116,7 +111,6 @@ Ref<AudioStreamPlayback> AudioStreamMicrophone::instance_playback() { } String AudioStreamMicrophone::get_stream_name() const { - //if (audio_stream.is_valid()) { //return "Random: " + audio_stream->get_name(); //} @@ -134,7 +128,6 @@ AudioStreamMicrophone::AudioStreamMicrophone() { } void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_frames) { - AudioDriver::get_singleton()->lock(); Vector<int32_t> buf = AudioDriver::get_singleton()->get_input_buffer(); @@ -187,7 +180,6 @@ float AudioStreamPlaybackMicrophone::get_stream_sampling_rate() { } void AudioStreamPlaybackMicrophone::start(float p_from_pos) { - if (active) { return; } @@ -239,7 +231,6 @@ AudioStreamPlaybackMicrophone::AudioStreamPlaybackMicrophone() { //////////////////////////////// void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_stream) { - audio_stream = p_audio_stream; if (audio_stream.is_valid()) { for (Set<AudioStreamPlaybackRandomPitch *>::Element *E = playbacks.front(); E; E = E->next()) { @@ -249,12 +240,10 @@ void AudioStreamRandomPitch::set_audio_stream(const Ref<AudioStream> &p_audio_st } Ref<AudioStream> AudioStreamRandomPitch::get_audio_stream() const { - return audio_stream; } void AudioStreamRandomPitch::set_random_pitch(float p_pitch) { - if (p_pitch < 1) p_pitch = 1; random_pitch = p_pitch; @@ -276,7 +265,6 @@ Ref<AudioStreamPlayback> AudioStreamRandomPitch::instance_playback() { } String AudioStreamRandomPitch::get_stream_name() const { - if (audio_stream.is_valid()) { return "Random: " + audio_stream->get_name(); } @@ -292,7 +280,6 @@ float AudioStreamRandomPitch::get_length() const { } void AudioStreamRandomPitch::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_audio_stream", "stream"), &AudioStreamRandomPitch::set_audio_stream); ClassDB::bind_method(D_METHOD("get_audio_stream"), &AudioStreamRandomPitch::get_audio_stream); diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h index 155b683d7d..fc66fd1ff7 100644 --- a/servers/audio/audio_stream.h +++ b/servers/audio/audio_stream.h @@ -37,7 +37,6 @@ #include "servers/audio_server.h" class AudioStreamPlayback : public Reference { - GDCLASS(AudioStreamPlayback, Reference); public: @@ -54,7 +53,6 @@ public: }; class AudioStreamPlaybackResampled : public AudioStreamPlayback { - GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback); enum { @@ -80,7 +78,6 @@ public: }; class AudioStream : public Resource { - GDCLASS(AudioStream, Resource); OBJ_SAVE_TYPE(AudioStream); // Saves derived classes with common type so they can be interchanged. @@ -99,7 +96,6 @@ public: class AudioStreamPlaybackMicrophone; class AudioStreamMicrophone : public AudioStream { - GDCLASS(AudioStreamMicrophone, AudioStream); friend class AudioStreamPlaybackMicrophone; @@ -118,7 +114,6 @@ public: }; class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled { - GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlaybackResampled); friend class AudioStreamMicrophone; @@ -152,7 +147,6 @@ public: class AudioStreamPlaybackRandomPitch; class AudioStreamRandomPitch : public AudioStream { - GDCLASS(AudioStreamRandomPitch, AudioStream); friend class AudioStreamPlaybackRandomPitch; @@ -179,7 +173,6 @@ public: }; class AudioStreamPlaybackRandomPitch : public AudioStreamPlayback { - GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback); friend class AudioStreamRandomPitch; diff --git a/servers/audio/effects/audio_effect_amplify.cpp b/servers/audio/effects/audio_effect_amplify.cpp index 8ad2ecc5ce..74fdcbc67a 100644 --- a/servers/audio/effects/audio_effect_amplify.cpp +++ b/servers/audio/effects/audio_effect_amplify.cpp @@ -31,7 +31,6 @@ #include "audio_effect_amplify.h" void AudioEffectAmplifyInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - //multiply volume interpolating to avoid clicks if this changes float volume_db = base->volume_db; float vol = Math::db2linear(mix_volume_db); @@ -58,12 +57,10 @@ void AudioEffectAmplify::set_volume_db(float p_volume) { } float AudioEffectAmplify::get_volume_db() const { - return volume_db; } void AudioEffectAmplify::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_volume_db", "volume"), &AudioEffectAmplify::set_volume_db); ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioEffectAmplify::get_volume_db); diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp index 34c03dca8d..11d820f828 100644 --- a/servers/audio/effects/audio_effect_chorus.cpp +++ b/servers/audio/effects/audio_effect_chorus.cpp @@ -33,11 +33,9 @@ #include "servers/audio_server.h" void AudioEffectChorusInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - int todo = p_frame_count; while (todo) { - int to_mix = MIN(todo, 256); //can't mix too much _process_chunk(p_src_frames, p_dst_frames, to_mix); @@ -50,7 +48,6 @@ void AudioEffectChorusInstance::process(const AudioFrame *p_src_frames, AudioFra } void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - //fill ringbuffer for (int i = 0; i < p_frame_count; i++) { audio_buffer.write[(buffer_pos + i) & buffer_mask] = p_src_frames[i]; @@ -61,7 +58,6 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A /* process voices */ for (int vc = 0; vc < base->voice_count; vc++) { - AudioEffectChorus::Voice &v = base->voice[vc]; double time_to_mix = (float)p_frame_count / mix_rate; @@ -103,7 +99,6 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A vol_modifier.r *= CLAMP(1.0 + v.pan, 0, 1); for (int i = 0; i < p_frame_count; i++) { - /** COMPUTE WAVEFORM **/ float phase = (float)(local_cycles & AudioEffectChorus::CYCLES_MASK) / (float)(1 << AudioEffectChorus::CYCLES_FRAC); @@ -146,7 +141,6 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A } Ref<AudioEffectInstance> AudioEffectChorus::instance() { - Ref<AudioEffectChorusInstance> ins; ins.instance(); ins->base = Ref<AudioEffectChorus>(this); @@ -182,24 +176,20 @@ Ref<AudioEffectInstance> AudioEffectChorus::instance() { } void AudioEffectChorus::set_voice_count(int p_voices) { - ERR_FAIL_COND(p_voices < 1 || p_voices > MAX_VOICES); voice_count = p_voices; } int AudioEffectChorus::get_voice_count() const { - return voice_count; } void AudioEffectChorus::set_voice_delay_ms(int p_voice, float p_delay_ms) { - ERR_FAIL_INDEX(p_voice, MAX_VOICES); voice[p_voice].delay = p_delay_ms; } float AudioEffectChorus::get_voice_delay_ms(int p_voice) const { - ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].delay; } @@ -210,84 +200,70 @@ void AudioEffectChorus::set_voice_rate_hz(int p_voice, float p_rate_hz) { voice[p_voice].rate = p_rate_hz; } float AudioEffectChorus::get_voice_rate_hz(int p_voice) const { - ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].rate; } void AudioEffectChorus::set_voice_depth_ms(int p_voice, float p_depth_ms) { - ERR_FAIL_INDEX(p_voice, MAX_VOICES); voice[p_voice].depth = p_depth_ms; } float AudioEffectChorus::get_voice_depth_ms(int p_voice) const { - ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].depth; } void AudioEffectChorus::set_voice_level_db(int p_voice, float p_level_db) { - ERR_FAIL_INDEX(p_voice, MAX_VOICES); voice[p_voice].level = p_level_db; } float AudioEffectChorus::get_voice_level_db(int p_voice) const { - ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].level; } void AudioEffectChorus::set_voice_cutoff_hz(int p_voice, float p_cutoff_hz) { - ERR_FAIL_INDEX(p_voice, MAX_VOICES); voice[p_voice].cutoff = p_cutoff_hz; } float AudioEffectChorus::get_voice_cutoff_hz(int p_voice) const { - ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].cutoff; } void AudioEffectChorus::set_voice_pan(int p_voice, float p_pan) { - ERR_FAIL_INDEX(p_voice, MAX_VOICES); voice[p_voice].pan = p_pan; } float AudioEffectChorus::get_voice_pan(int p_voice) const { - ERR_FAIL_INDEX_V(p_voice, MAX_VOICES, 0); return voice[p_voice].pan; } void AudioEffectChorus::set_wet(float amount) { - wet = amount; } float AudioEffectChorus::get_wet() const { - return wet; } void AudioEffectChorus::set_dry(float amount) { - dry = amount; } float AudioEffectChorus::get_dry() const { - return dry; } void AudioEffectChorus::_validate_property(PropertyInfo &property) const { - if (property.name.begins_with("voice/")) { int voice_idx = property.name.get_slice("/", 1).to_int(); if (voice_idx > voice_count) { @@ -297,7 +273,6 @@ void AudioEffectChorus::_validate_property(PropertyInfo &property) const { } void AudioEffectChorus::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_voice_count", "voices"), &AudioEffectChorus::set_voice_count); ClassDB::bind_method(D_METHOD("get_voice_count"), &AudioEffectChorus::get_voice_count); diff --git a/servers/audio/effects/audio_effect_chorus.h b/servers/audio/effects/audio_effect_chorus.h index ab5053b919..4d15c518d6 100644 --- a/servers/audio/effects/audio_effect_chorus.h +++ b/servers/audio/effects/audio_effect_chorus.h @@ -73,7 +73,6 @@ public: private: struct Voice { - float delay; float rate; float depth; @@ -82,7 +81,6 @@ private: float pan; Voice() { - delay = 12.0; rate = 1; depth = 0; diff --git a/servers/audio/effects/audio_effect_compressor.cpp b/servers/audio/effects/audio_effect_compressor.cpp index 8d54bd8e36..b4728314b6 100644 --- a/servers/audio/effects/audio_effect_compressor.cpp +++ b/servers/audio/effects/audio_effect_compressor.cpp @@ -32,7 +32,6 @@ #include "servers/audio_server.h" void AudioEffectCompressorInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float threshold = Math::db2linear(base->threshold); float sample_rate = AudioServer::get_singleton()->get_mix_rate(); @@ -51,7 +50,6 @@ void AudioEffectCompressorInstance::process(const AudioFrame *p_src_frames, Audi const AudioFrame *src = p_src_frames; if (base->sidechain != StringName() && current_channel != -1) { - int bus = AudioServer::get_singleton()->thread_find_bus_index(base->sidechain); if (bus >= 0) { src = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus, current_channel); @@ -59,7 +57,6 @@ void AudioEffectCompressorInstance::process(const AudioFrame *p_src_frames, Audi } for (int i = 0; i < p_frame_count; i++) { - AudioFrame s = src[i]; //convert to positive s.l = Math::abs(s.l); @@ -127,76 +124,60 @@ Ref<AudioEffectInstance> AudioEffectCompressor::instance() { } void AudioEffectCompressor::set_threshold(float p_threshold) { - threshold = p_threshold; } float AudioEffectCompressor::get_threshold() const { - return threshold; } void AudioEffectCompressor::set_ratio(float p_ratio) { - ratio = p_ratio; } float AudioEffectCompressor::get_ratio() const { - return ratio; } void AudioEffectCompressor::set_gain(float p_gain) { - gain = p_gain; } float AudioEffectCompressor::get_gain() const { - return gain; } void AudioEffectCompressor::set_attack_us(float p_attack_us) { - attack_us = p_attack_us; } float AudioEffectCompressor::get_attack_us() const { - return attack_us; } void AudioEffectCompressor::set_release_ms(float p_release_ms) { - release_ms = p_release_ms; } float AudioEffectCompressor::get_release_ms() const { - return release_ms; } void AudioEffectCompressor::set_mix(float p_mix) { - mix = p_mix; } float AudioEffectCompressor::get_mix() const { - return mix; } void AudioEffectCompressor::set_sidechain(const StringName &p_sidechain) { - AudioServer::get_singleton()->lock(); sidechain = p_sidechain; AudioServer::get_singleton()->unlock(); } StringName AudioEffectCompressor::get_sidechain() const { - return sidechain; } void AudioEffectCompressor::_validate_property(PropertyInfo &property) const { - if (property.name == "sidechain") { - String buses = ""; for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { buses += ","; @@ -208,7 +189,6 @@ void AudioEffectCompressor::_validate_property(PropertyInfo &property) const { } void AudioEffectCompressor::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_threshold", "threshold"), &AudioEffectCompressor::set_threshold); ClassDB::bind_method(D_METHOD("get_threshold"), &AudioEffectCompressor::get_threshold); diff --git a/servers/audio/effects/audio_effect_delay.cpp b/servers/audio/effects/audio_effect_delay.cpp index fa57a94977..2a613ad4f1 100644 --- a/servers/audio/effects/audio_effect_delay.cpp +++ b/servers/audio/effects/audio_effect_delay.cpp @@ -33,11 +33,9 @@ #include "servers/audio_server.h" void AudioEffectDelayInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - int todo = p_frame_count; while (todo) { - int to_mix = MIN(todo, 256); //can't mix too much _process_chunk(p_src_frames, p_dst_frames, to_mix); @@ -50,7 +48,6 @@ void AudioEffectDelayInstance::process(const AudioFrame *p_src_frames, AudioFram } void AudioEffectDelayInstance::_process_chunk(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float main_level_f = base->dry; float mix_rate = AudioServer::get_singleton()->get_mix_rate(); @@ -87,7 +84,6 @@ void AudioEffectDelayInstance::_process_chunk(const AudioFrame *p_src_frames, Au AudioFrame *fb_buf = feedback_buffer.ptrw(); for (int i = 0; i < p_frame_count; i++) { - rb_buf[ring_buffer_pos & ring_buffer_mask] = src[i]; AudioFrame main_val = src[i] * main_level_f; @@ -147,125 +143,98 @@ Ref<AudioEffectInstance> AudioEffectDelay::instance() { } void AudioEffectDelay::set_dry(float p_dry) { - dry = p_dry; } float AudioEffectDelay::get_dry() { - return dry; } void AudioEffectDelay::set_tap1_active(bool p_active) { - tap_1_active = p_active; } bool AudioEffectDelay::is_tap1_active() const { - return tap_1_active; } void AudioEffectDelay::set_tap1_delay_ms(float p_delay_ms) { - tap_1_delay_ms = p_delay_ms; } float AudioEffectDelay::get_tap1_delay_ms() const { - return tap_1_delay_ms; } void AudioEffectDelay::set_tap1_level_db(float p_level_db) { - tap_1_level = p_level_db; } float AudioEffectDelay::get_tap1_level_db() const { - return tap_1_level; } void AudioEffectDelay::set_tap1_pan(float p_pan) { - tap_1_pan = p_pan; } float AudioEffectDelay::get_tap1_pan() const { - return tap_1_pan; } void AudioEffectDelay::set_tap2_active(bool p_active) { - tap_2_active = p_active; } bool AudioEffectDelay::is_tap2_active() const { - return tap_2_active; } void AudioEffectDelay::set_tap2_delay_ms(float p_delay_ms) { - tap_2_delay_ms = p_delay_ms; } float AudioEffectDelay::get_tap2_delay_ms() const { - return tap_2_delay_ms; } void AudioEffectDelay::set_tap2_level_db(float p_level_db) { - tap_2_level = p_level_db; } float AudioEffectDelay::get_tap2_level_db() const { - return tap_2_level; } void AudioEffectDelay::set_tap2_pan(float p_pan) { - tap_2_pan = p_pan; } float AudioEffectDelay::get_tap2_pan() const { - return tap_2_pan; } void AudioEffectDelay::set_feedback_active(bool p_active) { - feedback_active = p_active; } bool AudioEffectDelay::is_feedback_active() const { - return feedback_active; } void AudioEffectDelay::set_feedback_delay_ms(float p_delay_ms) { - feedback_delay_ms = p_delay_ms; } float AudioEffectDelay::get_feedback_delay_ms() const { - return feedback_delay_ms; } void AudioEffectDelay::set_feedback_level_db(float p_level_db) { - feedback_level = p_level_db; } float AudioEffectDelay::get_feedback_level_db() const { - return feedback_level; } void AudioEffectDelay::set_feedback_lowpass(float p_lowpass) { - feedback_lowpass = p_lowpass; } float AudioEffectDelay::get_feedback_lowpass() const { - return feedback_lowpass; } void AudioEffectDelay::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_dry", "amount"), &AudioEffectDelay::set_dry); ClassDB::bind_method(D_METHOD("get_dry"), &AudioEffectDelay::get_dry); diff --git a/servers/audio/effects/audio_effect_distortion.cpp b/servers/audio/effects/audio_effect_distortion.cpp index bc4fc7ecd6..7726b3da3e 100644 --- a/servers/audio/effects/audio_effect_distortion.cpp +++ b/servers/audio/effects/audio_effect_distortion.cpp @@ -33,7 +33,6 @@ #include "servers/audio_server.h" void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - const float *src = (const float *)p_src_frames; float *dst = (float *)p_dst_frames; @@ -51,7 +50,6 @@ void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, Audi float lofi_mult = powf(2.0, 2.0 + (1.0 - drive_f) * 14); //goes from 16 to 2 bits for (int i = 0; i < p_frame_count * 2; i++) { - float out = undenormalise(src[i] * lpf_ic + lpf_c * h[i & 1]); h[i & 1] = out; float a = out; @@ -59,9 +57,7 @@ void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, Audi a *= pregain_f; switch (base->mode) { - case AudioEffectDistortion::MODE_CLIP: { - a = powf(a, 1.0001 - drive_f); if (a > 1.0) a = 1.0; @@ -70,17 +66,14 @@ void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, Audi } break; case AudioEffectDistortion::MODE_ATAN: { - a = atanf(a * atan_mult) * atan_div; } break; case AudioEffectDistortion::MODE_LOFI: { - a = floorf(a * lofi_mult + 0.5) / lofi_mult; } break; case AudioEffectDistortion::MODE_OVERDRIVE: { - const double x = a * 0.686306; const double z = 1 + exp(sqrt(fabs(x)) * -0.75); a = (expf(x) - expf(-x * z)) / (expf(x) + expf(-x)); @@ -109,53 +102,42 @@ Ref<AudioEffectInstance> AudioEffectDistortion::instance() { } void AudioEffectDistortion::set_mode(Mode p_mode) { - mode = p_mode; } AudioEffectDistortion::Mode AudioEffectDistortion::get_mode() const { - return mode; } void AudioEffectDistortion::set_pre_gain(float p_pre_gain) { - pre_gain = p_pre_gain; } float AudioEffectDistortion::get_pre_gain() const { - return pre_gain; } void AudioEffectDistortion::set_keep_hf_hz(float p_keep_hf_hz) { - keep_hf_hz = p_keep_hf_hz; } float AudioEffectDistortion::get_keep_hf_hz() const { - return keep_hf_hz; } void AudioEffectDistortion::set_drive(float p_drive) { - drive = p_drive; } float AudioEffectDistortion::get_drive() const { - return drive; } void AudioEffectDistortion::set_post_gain(float p_post_gain) { - post_gain = p_post_gain; } float AudioEffectDistortion::get_post_gain() const { - return post_gain; } void AudioEffectDistortion::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mode", "mode"), &AudioEffectDistortion::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &AudioEffectDistortion::get_mode); diff --git a/servers/audio/effects/audio_effect_eq.cpp b/servers/audio/effects/audio_effect_eq.cpp index b315fdc3bb..e8d38f87a3 100644 --- a/servers/audio/effects/audio_effect_eq.cpp +++ b/servers/audio/effects/audio_effect_eq.cpp @@ -32,7 +32,6 @@ #include "servers/audio_server.h" void AudioEffectEQInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - int band_count = bands[0].size(); EQ::BandProcess *proc_l = bands[0].ptrw(); EQ::BandProcess *proc_r = bands[1].ptrw(); @@ -42,12 +41,10 @@ void AudioEffectEQInstance::process(const AudioFrame *p_src_frames, AudioFrame * } for (int i = 0; i < p_frame_count; i++) { - AudioFrame src = p_src_frames[i]; AudioFrame dst = AudioFrame(0, 0); for (int j = 0; j < band_count; j++) { - float l = src.l; float r = src.r; @@ -92,7 +89,6 @@ int AudioEffectEQ::get_band_count() const { } bool AudioEffectEQ::_set(const StringName &p_name, const Variant &p_value) { - const Map<StringName, int>::Element *E = prop_band_map.find(p_name); if (E) { set_band_gain_db(E->get(), p_value); @@ -103,7 +99,6 @@ bool AudioEffectEQ::_set(const StringName &p_name, const Variant &p_value) { } bool AudioEffectEQ::_get(const StringName &p_name, Variant &r_ret) const { - const Map<StringName, int>::Element *E = prop_band_map.find(p_name); if (E) { r_ret = get_band_gain_db(E->get()); @@ -114,22 +109,18 @@ bool AudioEffectEQ::_get(const StringName &p_name, Variant &r_ret) const { } void AudioEffectEQ::_get_property_list(List<PropertyInfo> *p_list) const { - for (int i = 0; i < band_names.size(); i++) { - p_list->push_back(PropertyInfo(Variant::FLOAT, band_names[i], PROPERTY_HINT_RANGE, "-60,24,0.1")); } } void AudioEffectEQ::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_band_gain_db", "band_idx", "volume_db"), &AudioEffectEQ::set_band_gain_db); ClassDB::bind_method(D_METHOD("get_band_gain_db", "band_idx"), &AudioEffectEQ::get_band_gain_db); ClassDB::bind_method(D_METHOD("get_band_count"), &AudioEffectEQ::get_band_count); } AudioEffectEQ::AudioEffectEQ(EQ::Preset p_preset) { - eq.set_mix_rate(AudioServer::get_singleton()->get_mix_rate()); eq.set_preset_band_mode(p_preset); gain.resize(eq.get_band_count()); diff --git a/servers/audio/effects/audio_effect_filter.cpp b/servers/audio/effects/audio_effect_filter.cpp index 18047bc99e..664b1785d4 100644 --- a/servers/audio/effects/audio_effect_filter.cpp +++ b/servers/audio/effects/audio_effect_filter.cpp @@ -33,7 +33,6 @@ template <int S> void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - for (int i = 0; i < p_frame_count; i++) { float f = p_src_frames[i].l; filter_process[0][0].process_one(f); @@ -62,7 +61,6 @@ void AudioEffectFilterInstance::_process_filter(const AudioFrame *p_src_frames, } void AudioEffectFilterInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - filter.set_cutoff(base->cutoff); filter.set_gain(base->gain); filter.set_resonance(base->resonance); @@ -89,7 +87,6 @@ void AudioEffectFilterInstance::process(const AudioFrame *p_src_frames, AudioFra } AudioEffectFilterInstance::AudioEffectFilterInstance() { - for (int i = 0; i < 2; i++) { for (int j = 0; j < 4; j++) { filter_process[i][j].set_filter(&filter); @@ -106,30 +103,24 @@ Ref<AudioEffectInstance> AudioEffectFilter::instance() { } void AudioEffectFilter::set_cutoff(float p_freq) { - cutoff = p_freq; } float AudioEffectFilter::get_cutoff() const { - return cutoff; } void AudioEffectFilter::set_resonance(float p_amount) { - resonance = p_amount; } float AudioEffectFilter::get_resonance() const { - return resonance; } void AudioEffectFilter::set_gain(float p_amount) { - gain = p_amount; } float AudioEffectFilter::get_gain() const { - return gain; } @@ -138,12 +129,10 @@ void AudioEffectFilter::set_db(FilterDB p_db) { } AudioEffectFilter::FilterDB AudioEffectFilter::get_db() const { - return db; } void AudioEffectFilter::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_cutoff", "freq"), &AudioEffectFilter::set_cutoff); ClassDB::bind_method(D_METHOD("get_cutoff"), &AudioEffectFilter::get_cutoff); @@ -168,7 +157,6 @@ void AudioEffectFilter::_bind_methods() { } AudioEffectFilter::AudioEffectFilter(AudioFilterSW::Mode p_mode) { - mode = p_mode; cutoff = 2000; resonance = 0.5; diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp index 40a4243168..aab217cde9 100644 --- a/servers/audio/effects/audio_effect_limiter.cpp +++ b/servers/audio/effects/audio_effect_limiter.cpp @@ -31,7 +31,6 @@ #include "audio_effect_limiter.h" void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float threshdb = base->threshold; float ceiling = Math::db2linear(base->ceiling); float ceildb = base->ceiling; @@ -42,7 +41,6 @@ void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFr float scmult = Math::abs((ceildb - sc) / (peakdb - sc)); for (int i = 0; i < p_frame_count; i++) { - float spl0 = p_src_frames[i].l; float spl1 = p_src_frames[i].r; spl0 = spl0 * makeup; @@ -78,44 +76,35 @@ Ref<AudioEffectInstance> AudioEffectLimiter::instance() { } void AudioEffectLimiter::set_threshold_db(float p_threshold) { - threshold = p_threshold; } float AudioEffectLimiter::get_threshold_db() const { - return threshold; } void AudioEffectLimiter::set_ceiling_db(float p_ceiling) { - ceiling = p_ceiling; } float AudioEffectLimiter::get_ceiling_db() const { - return ceiling; } void AudioEffectLimiter::set_soft_clip_db(float p_soft_clip) { - soft_clip = p_soft_clip; } float AudioEffectLimiter::get_soft_clip_db() const { - return soft_clip; } void AudioEffectLimiter::set_soft_clip_ratio(float p_soft_clip) { - soft_clip_ratio = p_soft_clip; } float AudioEffectLimiter::get_soft_clip_ratio() const { - return soft_clip_ratio; } void AudioEffectLimiter::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_ceiling_db", "ceiling"), &AudioEffectLimiter::set_ceiling_db); ClassDB::bind_method(D_METHOD("get_ceiling_db"), &AudioEffectLimiter::get_ceiling_db); diff --git a/servers/audio/effects/audio_effect_panner.cpp b/servers/audio/effects/audio_effect_panner.cpp index 10724175e5..32b7921d1f 100644 --- a/servers/audio/effects/audio_effect_panner.cpp +++ b/servers/audio/effects/audio_effect_panner.cpp @@ -31,12 +31,10 @@ #include "audio_effect_panner.h" void AudioEffectPannerInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float lvol = CLAMP(1.0 - base->pan, 0, 1); float rvol = CLAMP(1.0 + base->pan, 0, 1); for (int i = 0; i < p_frame_count; i++) { - p_dst_frames[i].l = p_src_frames[i].l * lvol + p_src_frames[i].r * (1.0 - rvol); p_dst_frames[i].r = p_src_frames[i].r * rvol + p_src_frames[i].l * (1.0 - lvol); } @@ -54,12 +52,10 @@ void AudioEffectPanner::set_pan(float p_cpanume) { } float AudioEffectPanner::get_pan() const { - return pan; } void AudioEffectPanner::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_pan", "cpanume"), &AudioEffectPanner::set_pan); ClassDB::bind_method(D_METHOD("get_pan"), &AudioEffectPanner::get_pan); diff --git a/servers/audio/effects/audio_effect_phaser.cpp b/servers/audio/effects/audio_effect_phaser.cpp index 3709b69d45..0d3d2f74a5 100644 --- a/servers/audio/effects/audio_effect_phaser.cpp +++ b/servers/audio/effects/audio_effect_phaser.cpp @@ -33,7 +33,6 @@ #include "servers/audio_server.h" void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float sampling_rate = AudioServer::get_singleton()->get_mix_rate(); float dmin = base->range_min / (sampling_rate / 2.0); @@ -42,7 +41,6 @@ void AudioEffectPhaserInstance::process(const AudioFrame *p_src_frames, AudioFra float increment = 2.f * Math_PI * (base->rate / sampling_rate); for (int i = 0; i < p_frame_count; i++) { - phase += increment; while (phase >= Math_PI * 2.f) { @@ -91,54 +89,43 @@ Ref<AudioEffectInstance> AudioEffectPhaser::instance() { } void AudioEffectPhaser::set_range_min_hz(float p_hz) { - range_min = p_hz; } float AudioEffectPhaser::get_range_min_hz() const { - return range_min; } void AudioEffectPhaser::set_range_max_hz(float p_hz) { - range_max = p_hz; } float AudioEffectPhaser::get_range_max_hz() const { - return range_max; } void AudioEffectPhaser::set_rate_hz(float p_hz) { - rate = p_hz; } float AudioEffectPhaser::get_rate_hz() const { - return rate; } void AudioEffectPhaser::set_feedback(float p_fbk) { - feedback = p_fbk; } float AudioEffectPhaser::get_feedback() const { - return feedback; } void AudioEffectPhaser::set_depth(float p_depth) { - depth = p_depth; } float AudioEffectPhaser::get_depth() const { - return depth; } void AudioEffectPhaser::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_range_min_hz", "hz"), &AudioEffectPhaser::set_range_min_hz); ClassDB::bind_method(D_METHOD("get_range_min_hz"), &AudioEffectPhaser::get_range_min_hz); diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index a74ac3c007..24d5d72f37 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -284,7 +284,6 @@ void SMBPitchShift::smbFft(float *fftBuffer, long fftFrameSize, long sign) /* clang-format on */ void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float sample_rate = AudioServer::get_singleton()->get_mix_rate(); float *in_l = (float *)p_src_frames; @@ -313,7 +312,6 @@ void AudioEffectPitchShift::set_pitch_scale(float p_pitch_scale) { } float AudioEffectPitchShift::get_pitch_scale() const { - return pitch_scale; } @@ -323,7 +321,6 @@ void AudioEffectPitchShift::set_oversampling(int p_oversampling) { } int AudioEffectPitchShift::get_oversampling() const { - return oversampling; } @@ -337,7 +334,6 @@ AudioEffectPitchShift::FFT_Size AudioEffectPitchShift::get_fft_size() const { } 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); diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h index c6528bafa9..48f8e5dc39 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.h +++ b/servers/audio/effects/audio_effect_pitch_shift.h @@ -34,7 +34,6 @@ #include "servers/audio/audio_effect.h" class SMBPitchShift { - enum { MAX_FRAME_LENGTH = 8192 }; diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index f2784679b5..79388b2dc7 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -101,7 +101,6 @@ void AudioEffectRecordInstance::_io_store_buffer() { } void AudioEffectRecordInstance::_thread_callback(void *_instance) { - AudioEffectRecordInstance *aeri = reinterpret_cast<AudioEffectRecordInstance *>(_instance); aeri->_io_thread_process(); @@ -124,7 +123,6 @@ void AudioEffectRecordInstance::init() { } void AudioEffectRecordInstance::finish() { - #ifdef NO_THREADS AudioServer::get_singleton()->remove_update_callback(&AudioEffectRecordInstance::_update, this); #else @@ -135,7 +133,6 @@ void AudioEffectRecordInstance::finish() { } AudioEffectRecordInstance::~AudioEffectRecordInstance() { - finish(); } diff --git a/servers/audio/effects/audio_effect_reverb.cpp b/servers/audio/effects/audio_effect_reverb.cpp index 6dccb2945b..3169e48d15 100644 --- a/servers/audio/effects/audio_effect_reverb.cpp +++ b/servers/audio/effects/audio_effect_reverb.cpp @@ -31,7 +31,6 @@ #include "audio_effect_reverb.h" #include "servers/audio_server.h" void AudioEffectReverbInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - for (int i = 0; i < 2; i++) { Reverb &r = reverb[i]; @@ -49,7 +48,6 @@ void AudioEffectReverbInstance::process(const AudioFrame *p_src_frames, AudioFra int offset = 0; while (todo) { - int to_mix = MIN(todo, Reverb::INPUT_BUFFER_MAX_SIZE); for (int j = 0; j < to_mix; j++) { @@ -75,7 +73,6 @@ void AudioEffectReverbInstance::process(const AudioFrame *p_src_frames, AudioFra } AudioEffectReverbInstance::AudioEffectReverbInstance() { - reverb[0].set_mix_rate(AudioServer::get_singleton()->get_mix_rate()); reverb[0].set_extra_spread_base(0); reverb[1].set_mix_rate(AudioServer::get_singleton()->get_mix_rate()); @@ -90,75 +87,58 @@ Ref<AudioEffectInstance> AudioEffectReverb::instance() { } void AudioEffectReverb::set_predelay_msec(float p_msec) { - predelay = p_msec; } void AudioEffectReverb::set_predelay_feedback(float p_feedback) { - predelay_fb = CLAMP(p_feedback, 0, 0.98); } void AudioEffectReverb::set_room_size(float p_size) { - room_size = p_size; } void AudioEffectReverb::set_damping(float p_damping) { - damping = p_damping; } void AudioEffectReverb::set_spread(float p_spread) { - spread = p_spread; } void AudioEffectReverb::set_dry(float p_dry) { - dry = p_dry; } void AudioEffectReverb::set_wet(float p_wet) { - wet = p_wet; } void AudioEffectReverb::set_hpf(float p_hpf) { - hpf = p_hpf; } float AudioEffectReverb::get_predelay_msec() const { - return predelay; } float AudioEffectReverb::get_predelay_feedback() const { - return predelay_fb; } float AudioEffectReverb::get_room_size() const { - return room_size; } float AudioEffectReverb::get_damping() const { - return damping; } float AudioEffectReverb::get_spread() const { - return spread; } float AudioEffectReverb::get_dry() const { - return dry; } float AudioEffectReverb::get_wet() const { - return wet; } float AudioEffectReverb::get_hpf() const { - return hpf; } void AudioEffectReverb::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_predelay_msec", "msec"), &AudioEffectReverb::set_predelay_msec); ClassDB::bind_method(D_METHOD("get_predelay_msec"), &AudioEffectReverb::get_predelay_msec); diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp index 680ef567fd..69337a49c8 100644 --- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp +++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp @@ -97,7 +97,6 @@ static void smbFft(float *fftBuffer, long fftFrameSize, long sign) } } void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - uint64_t time = OS::get_singleton()->get_ticks_usec(); //copy everything over first, since this only really does capture @@ -149,14 +148,12 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames } void AudioEffectSpectrumAnalyzerInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_magnitude_for_frequency_range", "from_hz", "to_hz", "mode"), &AudioEffectSpectrumAnalyzerInstance::get_magnitude_for_frequency_range, DEFVAL(MAGNITUDE_MAX)); BIND_ENUM_CONSTANT(MAGNITUDE_AVERAGE); BIND_ENUM_CONSTANT(MAGNITUDE_MAX); } Vector2 AudioEffectSpectrumAnalyzerInstance::get_magnitude_for_frequency_range(float p_begin, float p_end, MagnitudeMode p_mode) const { - if (last_fft_time == 0) { return Vector2(); } @@ -197,7 +194,6 @@ Vector2 AudioEffectSpectrumAnalyzerInstance::get_magnitude_for_frequency_range(f return avg; } else { - Vector2 max; for (int i = begin_pos; i <= end_pos; i++) { @@ -210,7 +206,6 @@ Vector2 AudioEffectSpectrumAnalyzerInstance::get_magnitude_for_frequency_range(f } Ref<AudioEffectInstance> AudioEffectSpectrumAnalyzer::instance() { - Ref<AudioEffectSpectrumAnalyzerInstance> ins; ins.instance(); ins->base = Ref<AudioEffectSpectrumAnalyzer>(this); @@ -237,7 +232,6 @@ void AudioEffectSpectrumAnalyzer::set_buffer_length(float p_seconds) { } float AudioEffectSpectrumAnalyzer::get_buffer_length() const { - return buffer_length; } @@ -259,7 +253,6 @@ AudioEffectSpectrumAnalyzer::FFT_Size AudioEffectSpectrumAnalyzer::get_fft_size( } void AudioEffectSpectrumAnalyzer::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_buffer_length", "seconds"), &AudioEffectSpectrumAnalyzer::set_buffer_length); ClassDB::bind_method(D_METHOD("get_buffer_length"), &AudioEffectSpectrumAnalyzer::get_buffer_length); diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp index a10aca02b2..6593e712a8 100644 --- a/servers/audio/effects/audio_effect_stereo_enhance.cpp +++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp @@ -31,14 +31,12 @@ #include "audio_effect_stereo_enhance.h" #include "servers/audio_server.h" void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) { - float intensity = base->pan_pullout; bool surround_mode = base->surround > 0; float surround_amount = base->surround; unsigned int delay_frames = (base->time_pullout / 1000.0) * AudioServer::get_singleton()->get_mix_rate(); for (int i = 0; i < p_frame_count; i++) { - float l = p_src_frames[i].l; float r = p_src_frames[i].r; @@ -48,7 +46,6 @@ void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, A r = (center + (r - center) * intensity); if (surround_mode) { - float val = (l + r) / 2.0; delay_ringbuff[ringbuff_pos & ringbuff_mask] = val; @@ -58,7 +55,6 @@ void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, A l += out; r += -out; } else { - float val = r; delay_ringbuff[ringbuff_pos & ringbuff_mask] = val; @@ -75,7 +71,6 @@ void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, A } AudioEffectStereoEnhanceInstance::~AudioEffectStereoEnhanceInstance() { - memdelete_arr(delay_ringbuff); } @@ -108,35 +103,28 @@ Ref<AudioEffectInstance> AudioEffectStereoEnhance::instance() { } void AudioEffectStereoEnhance::set_pan_pullout(float p_amount) { - pan_pullout = p_amount; } float AudioEffectStereoEnhance::get_pan_pullout() const { - return pan_pullout; } void AudioEffectStereoEnhance::set_time_pullout(float p_amount) { - time_pullout = p_amount; } float AudioEffectStereoEnhance::get_time_pullout() const { - return time_pullout; } void AudioEffectStereoEnhance::set_surround(float p_amount) { - surround = p_amount; } float AudioEffectStereoEnhance::get_surround() const { - return surround; } void AudioEffectStereoEnhance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_pan_pullout", "amount"), &AudioEffectStereoEnhance::set_pan_pullout); ClassDB::bind_method(D_METHOD("get_pan_pullout"), &AudioEffectStereoEnhance::get_pan_pullout); diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp index d272a2cdf7..e2f21ec6d2 100644 --- a/servers/audio/effects/audio_stream_generator.cpp +++ b/servers/audio/effects/audio_stream_generator.cpp @@ -35,21 +35,17 @@ void AudioStreamGenerator::set_mix_rate(float p_mix_rate) { } float AudioStreamGenerator::get_mix_rate() const { - return mix_rate; } void AudioStreamGenerator::set_buffer_length(float p_seconds) { - buffer_len = p_seconds; } float AudioStreamGenerator::get_buffer_length() const { - return buffer_len; } Ref<AudioStreamPlayback> AudioStreamGenerator::instance_playback() { - Ref<AudioStreamGeneratorPlayback> playback; playback.instance(); playback->generator = this; @@ -59,7 +55,6 @@ Ref<AudioStreamPlayback> AudioStreamGenerator::instance_playback() { return playback; } String AudioStreamGenerator::get_stream_name() const { - return "UserFeed"; } @@ -100,7 +95,6 @@ bool AudioStreamGeneratorPlayback::can_push_buffer(int p_frames) const { return buffer.space_left() >= p_frames; } bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frames) { - int to_write = p_frames.size(); if (buffer.space_left() < to_write) { return false; @@ -115,7 +109,6 @@ bool AudioStreamGeneratorPlayback::push_buffer(const PackedVector2Array &p_frame AudioFrame buf[2048]; int ofs = 0; while (to_write) { - int w = MIN(to_write, 2048); for (int i = 0; i < w; i++) { buf[i] = r[i + ofs]; @@ -143,7 +136,6 @@ void AudioStreamGeneratorPlayback::clear_buffer() { } void AudioStreamGeneratorPlayback::_mix_internal(AudioFrame *p_buffer, int p_frames) { - int read_amount = buffer.data_left(); if (p_frames < read_amount) { read_amount = p_frames; @@ -167,7 +159,6 @@ float AudioStreamGeneratorPlayback::get_stream_sampling_rate() { } void AudioStreamGeneratorPlayback::start(float p_from_pos) { - if (mixed == 0.0) { _begin_resample(); } @@ -180,7 +171,6 @@ void AudioStreamGeneratorPlayback::stop() { active = false; } bool AudioStreamGeneratorPlayback::is_playing() const { - return active; //always playing, can't be stopped } diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h index aee3459e17..763d913684 100644 --- a/servers/audio/effects/audio_stream_generator.h +++ b/servers/audio/effects/audio_stream_generator.h @@ -58,7 +58,6 @@ public: }; class AudioStreamGeneratorPlayback : public AudioStreamPlaybackResampled { - GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled); friend class AudioStreamGenerator; RingBuffer<AudioFrame> buffer; diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp index b90e8a2726..bbcf31d5a9 100644 --- a/servers/audio/effects/eq.cpp +++ b/servers/audio/effects/eq.cpp @@ -61,29 +61,23 @@ static int solve_quadratic(double a, double b, double c, double *r1, double *r2) } EQ::BandProcess::BandProcess() { - c1 = c2 = c3 = history.a1 = history.a2 = history.a3 = 0; history.b1 = history.b2 = history.b3 = 0; } void EQ::recalculate_band_coefficients() { - #define BAND_LOG(m_f) (log((m_f)) / log(2.)) for (int i = 0; i < band.size(); i++) { - double octave_size; double frq = band[i].freq; if (i == 0) { - octave_size = BAND_LOG(band[1].freq) - BAND_LOG(frq); } else if (i == (band.size() - 1)) { - octave_size = BAND_LOG(frq) - BAND_LOG(band[i - 1].freq); } else { - double next = BAND_LOG(band[i + 1].freq) - BAND_LOG(frq); double prev = BAND_LOG(frq) - BAND_LOG(band[i - 1].freq); octave_size = (next + prev) / 2.0; @@ -118,7 +112,6 @@ void EQ::recalculate_band_coefficients() { } void EQ::set_preset_band_mode(Preset p_preset) { - band.clear(); #define PUSH_BANDS(m_bands) \ @@ -130,16 +123,13 @@ void EQ::set_preset_band_mode(Preset p_preset) { } switch (p_preset) { - case PRESET_6_BANDS: { - static const double bands[] = { 32, 100, 320, 1e3, 3200, 10e3 }; PUSH_BANDS(6); } break; case PRESET_8_BANDS: { - static const double bands[] = { 32, 72, 192, 512, 1200, 3000, 7500, 16e3 }; PUSH_BANDS(8); @@ -153,14 +143,12 @@ void EQ::set_preset_band_mode(Preset p_preset) { } break; case PRESET_21_BANDS: { - static const double bands[] = { 22, 32, 44, 63, 90, 125, 175, 250, 350, 500, 700, 1e3, 1400, 2e3, 2800, 4e3, 5600, 8e3, 11e3, 16e3, 22e3 }; PUSH_BANDS(21); } break; case PRESET_31_BANDS: { - static const double bands[] = { 20, 25, 31.5, 40, 50, 63, 80, 100, 125, 160, 200, 250, 315, 400, 500, 630, 800, 1e3, 1250, 1600, 2e3, 2500, 3150, 4e3, 5e3, 6300, 8e3, 10e3, 12500, 16e3, 20e3 }; PUSH_BANDS(31); } break; @@ -170,19 +158,15 @@ void EQ::set_preset_band_mode(Preset p_preset) { } int EQ::get_band_count() const { - return band.size(); } float EQ::get_band_frequency(int p_band) { - ERR_FAIL_INDEX_V(p_band, band.size(), 0); return band[p_band].freq; } void EQ::set_bands(const Vector<float> &p_bands) { - band.resize(p_bands.size()); for (int i = 0; i < p_bands.size(); i++) { - band.write[i].freq = p_bands[i]; } @@ -190,13 +174,11 @@ void EQ::set_bands(const Vector<float> &p_bands) { } void EQ::set_mix_rate(float p_mix_rate) { - mix_rate = p_mix_rate; recalculate_band_coefficients(); } EQ::BandProcess EQ::get_band_processor(int p_band) const { - EQ::BandProcess band_proc; ERR_FAIL_INDEX_V(p_band, band.size(), band_proc); diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h index 6c002effbf..391a7aa24b 100644 --- a/servers/audio/effects/eq.h +++ b/servers/audio/effects/eq.h @@ -52,7 +52,6 @@ public: }; class BandProcess { - friend class EQ; float c1, c2, c3; struct History { @@ -69,7 +68,6 @@ public: private: struct Band { - float freq; float c1, c2, c3; }; @@ -96,7 +94,6 @@ public: /* Inline Function */ inline void EQ::BandProcess::process_one(float &p_data) { - history.a1 = p_data; history.b1 = c1 * (history.a1 - history.a3) + c3 * history.b2 - c2 * history.b3; diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp index 02565f4516..6cfba28b05 100644 --- a/servers/audio/effects/reverb.cpp +++ b/servers/audio/effects/reverb.cpp @@ -57,7 +57,6 @@ const float Reverb::allpass_tunings[MAX_ALLPASS] = { }; void Reverb::process(float *p_src, float *p_dst, int p_frames) { - if (p_frames > INPUT_BUFFER_MAX_SIZE) p_frames = INPUT_BUFFER_MAX_SIZE; @@ -68,7 +67,6 @@ void Reverb::process(float *p_src, float *p_dst, int p_frames) { predelay_frames = echo_buffer_size - 1; for (int i = 0; i < p_frames; i++) { - if (echo_buffer_pos >= echo_buffer_size) echo_buffer_pos = 0; @@ -94,7 +92,6 @@ void Reverb::process(float *p_src, float *p_dst, int p_frames) { float hp_b1 = hpaux; for (int i = 0; i < p_frames; i++) { - float in = input_buffer[i]; input_buffer[i] = in * hp_a1 + hpf_h1 * hp_a2 + hpf_h2 * hp_b1; hpf_h2 = input_buffer[i]; @@ -103,12 +100,10 @@ void Reverb::process(float *p_src, float *p_dst, int p_frames) { } for (int i = 0; i < MAX_COMBS; i++) { - Comb &c = comb[i]; int size_limit = c.size - lrintf((float)c.extra_spread_frames * (1.0 - params.extra_spread)); for (int j = 0; j < p_frames; j++) { - if (c.pos >= size_limit) //reset this now just in case c.pos = 0; @@ -157,12 +152,10 @@ void Reverb::process(float *p_src, float *p_dst, int p_frames) { */ for (int i = 0; i < MAX_ALLPASS; i++) { - AllPass &a = allpass[i]; int size_limit = a.size - lrintf((float)a.extra_spread_frames * (1.0 - params.extra_spread)); for (int j = 0; j < p_frames; j++) { - if (a.pos >= size_limit) a.pos = 0; @@ -176,42 +169,34 @@ void Reverb::process(float *p_src, float *p_dst, int p_frames) { static const float wet_scale = 0.6; for (int i = 0; i < p_frames; i++) { - p_dst[i] = p_dst[i] * params.wet * wet_scale + p_src[i] * params.dry; } } void Reverb::set_room_size(float p_size) { - params.room_size = p_size; update_parameters(); } void Reverb::set_damp(float p_damp) { - params.damp = p_damp; update_parameters(); } void Reverb::set_wet(float p_wet) { - params.wet = p_wet; } void Reverb::set_dry(float p_dry) { - params.dry = p_dry; } void Reverb::set_predelay(float p_predelay) { - params.predelay = p_predelay; } void Reverb::set_predelay_feedback(float p_predelay_fb) { - params.predelay_fb = p_predelay_fb; } void Reverb::set_highpass(float p_frq) { - if (p_frq > 1) p_frq = 1; if (p_frq < 0) @@ -220,28 +205,23 @@ void Reverb::set_highpass(float p_frq) { } void Reverb::set_extra_spread(float p_spread) { - params.extra_spread = p_spread; } void Reverb::set_mix_rate(float p_mix_rate) { - params.mix_rate = p_mix_rate; configure_buffers(); } void Reverb::set_extra_spread_base(float p_sec) { - params.extra_spread_base = p_sec; configure_buffers(); } void Reverb::configure_buffers() { - clear_buffers(); //clear if necessary for (int i = 0; i < MAX_COMBS; i++) { - Comb &c = comb[i]; c.extra_spread_frames = lrint(params.extra_spread_base * params.mix_rate); @@ -258,7 +238,6 @@ void Reverb::configure_buffers() { } for (int i = 0; i < MAX_ALLPASS; i++) { - AllPass &a = allpass[i]; a.extra_spread_frames = lrint(params.extra_spread_base * params.mix_rate); @@ -277,7 +256,6 @@ void Reverb::configure_buffers() { echo_buffer_size = (int)(((float)MAX_ECHO_MS / 1000.0) * params.mix_rate + 1.0); echo_buffer = memnew_arr(float, echo_buffer_size); for (int i = 0; i < echo_buffer_size; i++) { - echo_buffer[i] = 0; } @@ -285,13 +263,11 @@ void Reverb::configure_buffers() { } void Reverb::update_parameters() { - //more freeverb derived constants static const float room_scale = 0.28f; static const float room_offset = 0.7f; for (int i = 0; i < MAX_COMBS; i++) { - Comb &c = comb[i]; c.feedback = room_offset + params.room_size * room_scale; if (c.feedback < room_offset) @@ -307,12 +283,10 @@ void Reverb::update_parameters() { } void Reverb::clear_buffers() { - if (echo_buffer) memdelete_arr(echo_buffer); for (int i = 0; i < MAX_COMBS; i++) { - if (comb[i].buffer) memdelete_arr(comb[i].buffer); @@ -320,7 +294,6 @@ void Reverb::clear_buffers() { } for (int i = 0; i < MAX_ALLPASS; i++) { - if (allpass[i].buffer) memdelete_arr(allpass[i].buffer); @@ -329,7 +302,6 @@ void Reverb::clear_buffers() { } Reverb::Reverb() { - params.room_size = 0.8; params.damp = 0.5; params.dry = 1.0; @@ -348,7 +320,6 @@ Reverb::Reverb() { } Reverb::~Reverb() { - memdelete_arr(input_buffer); clear_buffers(); } diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h index ed8c824148..614de0c534 100644 --- a/servers/audio/effects/reverb.h +++ b/servers/audio/effects/reverb.h @@ -57,7 +57,6 @@ private: static const float allpass_tunings[MAX_ALLPASS]; struct Comb { - int size = 0; float *buffer = nullptr; float feedback = 0; @@ -70,7 +69,6 @@ private: }; struct AllPass { - int size = 0; float *buffer = nullptr; int pos = 0; @@ -88,7 +86,6 @@ private: float hpf_h1, hpf_h2 = 0; struct Parameters { - float room_size; float damp; float wet; |