mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
Clean up double/float narrowing math in plugins.
This commit is contained in:
parent
070d8f5ee1
commit
3df530e7f6
3 changed files with 12 additions and 12 deletions
|
|
@ -266,12 +266,12 @@ sanitize_denormal(float value) {
|
|||
|
||||
static inline float
|
||||
from_dB(float gdb) {
|
||||
return (exp(gdb/20.f*log(10.f)));
|
||||
return powf (10.0f, 0.05f * gdb);
|
||||
}
|
||||
|
||||
static inline float
|
||||
to_dB(float g) {
|
||||
return (20.f*log10(g));
|
||||
return (20.f * log10f (g));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -300,8 +300,8 @@ run(LV2_Handle instance, uint32_t n_samples)
|
|||
|
||||
float srate = acomp->srate;
|
||||
float width = (6.f * *(acomp->knee)) + 0.01;
|
||||
float attack_coeff = exp(-1000.f/(*(acomp->attack) * srate));
|
||||
float release_coeff = exp(-1000.f/(*(acomp->release) * srate));
|
||||
float attack_coeff = expf (-1000.f / (*(acomp->attack) * srate));
|
||||
float release_coeff = expf (-1000.f / (*(acomp->release) * srate));
|
||||
|
||||
float max_out = 0.f;
|
||||
float Lgain = 1.f;
|
||||
|
|
@ -323,7 +323,7 @@ run(LV2_Handle instance, uint32_t n_samples)
|
|||
float makeup_target = from_dB(makeup);
|
||||
float makeup_gain = acomp->makeup_gain;
|
||||
|
||||
const float tau = (1.0 - exp (-2.f * M_PI * 25.f / acomp->srate));
|
||||
const float tau = (1.f - expf (-2.f * M_PI * 25.f / acomp->srate));
|
||||
|
||||
if (*acomp->enable <= 0) {
|
||||
ratio = 1.f;
|
||||
|
|
@ -446,7 +446,7 @@ run(LV2_Handle instance, uint32_t n_samples)
|
|||
if (acomp->v_gainr > knee_lim_gr) {
|
||||
state_x = acomp->v_gainr / (1.f - 1.f/ratio) + thresdb;
|
||||
} else {
|
||||
state_x = sqrt ( (2.f*width*acomp->v_gainr) / (1.f-1.f/ratio) ) + thresdb - width/2.f;
|
||||
state_x = sqrtf ( (2.f*width*acomp->v_gainr) / (1.f-1.f/ratio) ) + thresdb - width/2.f;
|
||||
}
|
||||
|
||||
if (fabsf (acomp->v_lvl_out - v_lvl_out) >= .1f ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue