diff options
Diffstat (limited to 'servers/audio/effects/audio_effect_limiter.cpp')
-rw-r--r-- | servers/audio/effects/audio_effect_limiter.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp index 5923cf8cf5..99653cf5b6 100644 --- a/servers/audio/effects/audio_effect_limiter.cpp +++ b/servers/audio/effects/audio_effect_limiter.cpp @@ -32,11 +32,11 @@ 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 ceiling = Math::db_to_linear(base->ceiling); float ceildb = base->ceiling; - float makeup = Math::db2linear(ceildb - threshdb); + float makeup = Math::db_to_linear(ceildb - threshdb); float sc = -base->soft_clip; - float scv = Math::db2linear(sc); + float scv = Math::db_to_linear(sc); float peakdb = ceildb + 25; float scmult = Math::abs((ceildb - sc) / (peakdb - sc)); @@ -49,14 +49,14 @@ void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFr float sign1 = (spl1 < 0.0 ? -1.0 : 1.0); float abs0 = Math::abs(spl0); float abs1 = Math::abs(spl1); - float overdb0 = Math::linear2db(abs0) - ceildb; - float overdb1 = Math::linear2db(abs1) - ceildb; + float overdb0 = Math::linear_to_db(abs0) - ceildb; + float overdb1 = Math::linear_to_db(abs1) - ceildb; if (abs0 > scv) { - spl0 = sign0 * (scv + Math::db2linear(overdb0 * scmult)); + spl0 = sign0 * (scv + Math::db_to_linear(overdb0 * scmult)); } if (abs1 > scv) { - spl1 = sign1 * (scv + Math::db2linear(overdb1 * scmult)); + spl1 = sign1 * (scv + Math::db_to_linear(overdb1 * scmult)); } spl0 = MIN(ceiling, Math::abs(spl0)) * (spl0 < 0.0 ? -1.0 : 1.0); @@ -120,9 +120,9 @@ void AudioEffectLimiter::_bind_methods() { ClassDB::bind_method(D_METHOD("set_soft_clip_ratio", "soft_clip"), &AudioEffectLimiter::set_soft_clip_ratio); ClassDB::bind_method(D_METHOD("get_soft_clip_ratio"), &AudioEffectLimiter::get_soft_clip_ratio); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ceiling_db", PROPERTY_HINT_RANGE, "-20,-0.1,0.1"), "set_ceiling_db", "get_ceiling_db"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "threshold_db", PROPERTY_HINT_RANGE, "-30,0,0.1"), "set_threshold_db", "get_threshold_db"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "soft_clip_db", PROPERTY_HINT_RANGE, "0,6,0.1"), "set_soft_clip_db", "get_soft_clip_db"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ceiling_db", PROPERTY_HINT_RANGE, "-20,-0.1,0.1,suffix:dB"), "set_ceiling_db", "get_ceiling_db"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "threshold_db", PROPERTY_HINT_RANGE, "-30,0,0.1,suffix:dB"), "set_threshold_db", "get_threshold_db"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "soft_clip_db", PROPERTY_HINT_RANGE, "0,6,0.1,suffix:dB"), "set_soft_clip_db", "get_soft_clip_db"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "soft_clip_ratio", PROPERTY_HINT_RANGE, "3,20,0.1"), "set_soft_clip_ratio", "get_soft_clip_ratio"); } |