2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* audio_effect_delay.cpp */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2017-01-22 19:14:45 +01:00
|
|
|
#include "audio_effect_delay.h"
|
2022-08-22 11:26:47 +02:00
|
|
|
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/math/math_funcs.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "servers/audio_server.h"
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelayInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
|
2017-01-22 19:14:45 +01:00
|
|
|
int todo = p_frame_count;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
while (todo) {
|
|
|
|
int to_mix = MIN(todo, 256); //can't mix too much
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_process_chunk(p_src_frames, p_dst_frames, to_mix);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
p_src_frames += to_mix;
|
|
|
|
p_dst_frames += to_mix;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
todo -= to_mix;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelayInstance::_process_chunk(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
|
|
|
|
float main_level_f = base->dry;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
|
|
|
float mix_rate = AudioServer::get_singleton()->get_mix_rate();
|
|
|
|
|
2022-08-13 17:45:42 +02:00
|
|
|
float tap_1_level_f = base->tap_1_active ? Math::db_to_linear(base->tap_1_level) : 0.0;
|
2017-03-05 16:44:50 +01:00
|
|
|
int tap_1_delay_frames = int((base->tap_1_delay_ms / 1000.0) * mix_rate);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2022-08-13 17:45:42 +02:00
|
|
|
float tap_2_level_f = base->tap_2_active ? Math::db_to_linear(base->tap_2_level) : 0.0;
|
2017-03-05 16:44:50 +01:00
|
|
|
int tap_2_delay_frames = int((base->tap_2_delay_ms / 1000.0) * mix_rate);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2022-08-13 17:45:42 +02:00
|
|
|
float feedback_level_f = base->feedback_active ? Math::db_to_linear(base->feedback_level) : 0.0;
|
2017-03-05 16:44:50 +01:00
|
|
|
unsigned int feedback_delay_frames = int((base->feedback_delay_ms / 1000.0) * mix_rate);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
AudioFrame tap1_vol = AudioFrame(tap_1_level_f, tap_1_level_f);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2024-01-09 15:01:12 +01:00
|
|
|
tap1_vol.left *= CLAMP(1.0 - base->tap_1_pan, 0, 1);
|
|
|
|
tap1_vol.right *= CLAMP(1.0 + base->tap_1_pan, 0, 1);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
AudioFrame tap2_vol = AudioFrame(tap_2_level_f, tap_2_level_f);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2024-01-09 15:01:12 +01:00
|
|
|
tap2_vol.left *= CLAMP(1.0 - base->tap_2_pan, 0, 1);
|
|
|
|
tap2_vol.right *= CLAMP(1.0 + base->tap_2_pan, 0, 1);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
|
|
|
// feedback lowpass here
|
2020-04-03 11:50:40 +02:00
|
|
|
float lpf_c = expf(-Math_TAU * base->feedback_lowpass / mix_rate); // 0 .. 10khz
|
2017-03-05 16:44:50 +01:00
|
|
|
float lpf_ic = 1.0 - lpf_c;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
const AudioFrame *src = p_src_frames;
|
|
|
|
AudioFrame *dst = p_dst_frames;
|
2017-11-25 04:07:54 +01:00
|
|
|
AudioFrame *rb_buf = ring_buffer.ptrw();
|
|
|
|
AudioFrame *fb_buf = feedback_buffer.ptrw();
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < p_frame_count; i++) {
|
|
|
|
rb_buf[ring_buffer_pos & ring_buffer_mask] = src[i];
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
AudioFrame main_val = src[i] * main_level_f;
|
|
|
|
AudioFrame tap_1_val = rb_buf[(ring_buffer_pos - tap_1_delay_frames) & ring_buffer_mask] * tap1_vol;
|
|
|
|
AudioFrame tap_2_val = rb_buf[(ring_buffer_pos - tap_2_delay_frames) & ring_buffer_mask] * tap2_vol;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
AudioFrame out = main_val + tap_1_val + tap_2_val;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
out += fb_buf[feedback_buffer_pos];
|
2017-01-22 19:14:45 +01:00
|
|
|
|
|
|
|
//apply lowpass and feedback gain
|
2017-03-05 16:44:50 +01:00
|
|
|
AudioFrame fb_in = out * feedback_level_f * lpf_ic + h * lpf_c;
|
2022-11-01 15:29:38 +01:00
|
|
|
fb_in.undenormalize(); //avoid denormals
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
h = fb_in;
|
|
|
|
fb_buf[feedback_buffer_pos] = fb_in;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
dst[i] = out;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
|
|
|
ring_buffer_pos++;
|
|
|
|
|
2020-05-14 16:41:43 +02:00
|
|
|
if ((++feedback_buffer_pos) >= feedback_delay_frames) {
|
2017-03-05 16:44:50 +01:00
|
|
|
feedback_buffer_pos = 0;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-18 00:03:09 +02:00
|
|
|
Ref<AudioEffectInstance> AudioEffectDelay::instantiate() {
|
2017-01-22 19:14:45 +01:00
|
|
|
Ref<AudioEffectDelayInstance> ins;
|
2021-06-18 00:03:09 +02:00
|
|
|
ins.instantiate();
|
2017-03-05 16:44:50 +01:00
|
|
|
ins->base = Ref<AudioEffectDelay>(this);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float ring_buffer_max_size = MAX_DELAY_MS + 100; //add 100ms of extra room, just in case
|
|
|
|
ring_buffer_max_size /= 1000.0; //convert to seconds
|
|
|
|
ring_buffer_max_size *= AudioServer::get_singleton()->get_mix_rate();
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int ringbuff_size = ring_buffer_max_size;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int bits = 0;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
while (ringbuff_size > 0) {
|
2017-01-22 19:14:45 +01:00
|
|
|
bits++;
|
2017-03-05 16:44:50 +01:00
|
|
|
ringbuff_size /= 2;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ringbuff_size = 1 << bits;
|
|
|
|
ins->ring_buffer_mask = ringbuff_size - 1;
|
|
|
|
ins->ring_buffer_pos = 0;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ins->ring_buffer.resize(ringbuff_size);
|
|
|
|
ins->feedback_buffer.resize(ringbuff_size);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ins->feedback_buffer_pos = 0;
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ins->h = AudioFrame(0, 0);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
|
|
|
return ins;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEffectDelay::set_dry(float p_dry) {
|
2017-03-05 16:44:50 +01:00
|
|
|
dry = p_dry;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_dry() {
|
2017-01-22 19:14:45 +01:00
|
|
|
return dry;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap1_active(bool p_active) {
|
|
|
|
tap_1_active = p_active;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool AudioEffectDelay::is_tap1_active() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_1_active;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap1_delay_ms(float p_delay_ms) {
|
|
|
|
tap_1_delay_ms = p_delay_ms;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_tap1_delay_ms() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_1_delay_ms;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap1_level_db(float p_level_db) {
|
|
|
|
tap_1_level = p_level_db;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_tap1_level_db() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_1_level;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap1_pan(float p_pan) {
|
|
|
|
tap_1_pan = p_pan;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_tap1_pan() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_1_pan;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap2_active(bool p_active) {
|
|
|
|
tap_2_active = p_active;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool AudioEffectDelay::is_tap2_active() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_2_active;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap2_delay_ms(float p_delay_ms) {
|
|
|
|
tap_2_delay_ms = p_delay_ms;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_tap2_delay_ms() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_2_delay_ms;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap2_level_db(float p_level_db) {
|
|
|
|
tap_2_level = p_level_db;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_tap2_level_db() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_2_level;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_tap2_pan(float p_pan) {
|
|
|
|
tap_2_pan = p_pan;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_tap2_pan() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return tap_2_pan;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_feedback_active(bool p_active) {
|
|
|
|
feedback_active = p_active;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool AudioEffectDelay::is_feedback_active() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return feedback_active;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_feedback_delay_ms(float p_delay_ms) {
|
|
|
|
feedback_delay_ms = p_delay_ms;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_feedback_delay_ms() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return feedback_delay_ms;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_feedback_level_db(float p_level_db) {
|
|
|
|
feedback_level = p_level_db;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_feedback_level_db() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return feedback_level;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void AudioEffectDelay::set_feedback_lowpass(float p_lowpass) {
|
|
|
|
feedback_lowpass = p_lowpass;
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
float AudioEffectDelay::get_feedback_lowpass() const {
|
2017-01-22 19:14:45 +01:00
|
|
|
return feedback_lowpass;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioEffectDelay::_bind_methods() {
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_dry", "amount"), &AudioEffectDelay::set_dry);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_dry"), &AudioEffectDelay::get_dry);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap1_active", "amount"), &AudioEffectDelay::set_tap1_active);
|
|
|
|
ClassDB::bind_method(D_METHOD("is_tap1_active"), &AudioEffectDelay::is_tap1_active);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap1_delay_ms", "amount"), &AudioEffectDelay::set_tap1_delay_ms);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tap1_delay_ms"), &AudioEffectDelay::get_tap1_delay_ms);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap1_level_db", "amount"), &AudioEffectDelay::set_tap1_level_db);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tap1_level_db"), &AudioEffectDelay::get_tap1_level_db);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap1_pan", "amount"), &AudioEffectDelay::set_tap1_pan);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tap1_pan"), &AudioEffectDelay::get_tap1_pan);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap2_active", "amount"), &AudioEffectDelay::set_tap2_active);
|
|
|
|
ClassDB::bind_method(D_METHOD("is_tap2_active"), &AudioEffectDelay::is_tap2_active);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap2_delay_ms", "amount"), &AudioEffectDelay::set_tap2_delay_ms);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tap2_delay_ms"), &AudioEffectDelay::get_tap2_delay_ms);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap2_level_db", "amount"), &AudioEffectDelay::set_tap2_level_db);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tap2_level_db"), &AudioEffectDelay::get_tap2_level_db);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tap2_pan", "amount"), &AudioEffectDelay::set_tap2_pan);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tap2_pan"), &AudioEffectDelay::get_tap2_pan);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_feedback_active", "amount"), &AudioEffectDelay::set_feedback_active);
|
|
|
|
ClassDB::bind_method(D_METHOD("is_feedback_active"), &AudioEffectDelay::is_feedback_active);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_feedback_delay_ms", "amount"), &AudioEffectDelay::set_feedback_delay_ms);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_feedback_delay_ms"), &AudioEffectDelay::get_feedback_delay_ms);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_feedback_level_db", "amount"), &AudioEffectDelay::set_feedback_level_db);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_feedback_level_db"), &AudioEffectDelay::get_feedback_level_db);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method(D_METHOD("set_feedback_lowpass", "amount"), &AudioEffectDelay::set_feedback_lowpass);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_feedback_lowpass"), &AudioEffectDelay::get_feedback_lowpass);
|
2017-01-22 19:14:45 +01:00
|
|
|
|
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-24 19:20:53 +01:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "dry", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_dry", "get_dry");
|
2017-01-22 19:14:45 +01:00
|
|
|
|
2022-08-22 11:26:47 +02:00
|
|
|
ADD_GROUP("Tap 1", "tap1_");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tap1_active"), "set_tap1_active", "is_tap1_active");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tap1_delay_ms", PROPERTY_HINT_RANGE, "0,1500,1,suffix:ms"), "set_tap1_delay_ms", "get_tap1_delay_ms");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tap1_level_db", PROPERTY_HINT_RANGE, "-60,0,0.01,suffix:dB"), "set_tap1_level_db", "get_tap1_level_db");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tap1_pan", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_tap1_pan", "get_tap1_pan");
|
|
|
|
|
|
|
|
ADD_GROUP("Tap 2", "tap2_");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tap2_active"), "set_tap2_active", "is_tap2_active");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tap2_delay_ms", PROPERTY_HINT_RANGE, "0,1500,1,suffix:ms"), "set_tap2_delay_ms", "get_tap2_delay_ms");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tap2_level_db", PROPERTY_HINT_RANGE, "-60,0,0.01,suffix:dB"), "set_tap2_level_db", "get_tap2_level_db");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "tap2_pan", PROPERTY_HINT_RANGE, "-1,1,0.01"), "set_tap2_pan", "get_tap2_pan");
|
|
|
|
|
|
|
|
ADD_GROUP("Feedback", "feedback_");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "feedback_active"), "set_feedback_active", "is_feedback_active");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "feedback_delay_ms", PROPERTY_HINT_RANGE, "0,1500,1,suffix:ms"), "set_feedback_delay_ms", "get_feedback_delay_ms");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "feedback_level_db", PROPERTY_HINT_RANGE, "-60,0,0.01,suffix:dB"), "set_feedback_level_db", "get_feedback_level_db");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "feedback_lowpass", PROPERTY_HINT_RANGE, "1,16000,1"), "set_feedback_lowpass", "get_feedback_lowpass");
|
2017-01-22 19:14:45 +01:00
|
|
|
}
|