summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2017-06-18 23:41:23 +0200
committerDamien Zammit <damien@zamaudio.com>2017-06-24 10:23:43 +1000
commit59a68b6333ab16a3a269b3ea2f255d0f71dc4a5d (patch)
tree8cb5b310e584256e30c397e3ccc7663398fc692b
parent3d2bbf93efe42412823722a17ae4da25db3b51f2 (diff)
Show a-comp's makeup grain in inline rendering
-rw-r--r--libs/plugins/a-comp.lv2/a-comp.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/plugins/a-comp.lv2/a-comp.c b/libs/plugins/a-comp.lv2/a-comp.c
index 43d6b31b90..3bcd7b9d02 100644
--- a/libs/plugins/a-comp.lv2/a-comp.c
+++ b/libs/plugins/a-comp.lv2/a-comp.c
@@ -99,6 +99,7 @@ typedef struct {
float v_knee;
float v_ratio;
float v_thresdb;
+ float v_makeup;
float v_lvl;
float v_lvl_in;
float v_lvl_out;
@@ -283,7 +284,8 @@ run_mono(LV2_Handle instance, uint32_t n_samples)
float ratio = *acomp->ratio;
float thresdb = *acomp->thresdb;
- float makeup_target = from_dB(*acomp->makeup);
+ float makeup = *acomp->makeup;
+ float makeup_target = from_dB(makeup);
float makeup_gain = acomp->makeup_gain;
const const float tau = acomp->tau;
@@ -291,6 +293,7 @@ run_mono(LV2_Handle instance, uint32_t n_samples)
if (*acomp->enable <= 0) {
ratio = 1.f;
thresdb = 0.f;
+ makeup = 0.f;
makeup_target = 1.f;
}
@@ -309,6 +312,11 @@ run_mono(LV2_Handle instance, uint32_t n_samples)
acomp->v_thresdb = thresdb;
acomp->need_expose = true;
}
+
+ if (acomp->v_makeup != makeup) {
+ acomp->v_makeup = makeup;
+ acomp->need_expose = true;
+ }
#endif
float in_peak = 0;
@@ -550,6 +558,7 @@ comp_curve (AComp* self, float xg) {
const float knee = self->v_knee;
const float ratio = self->v_ratio;
const float thresdb = self->v_thresdb;
+ const float makeup = self->v_makeup;
const float width = 6.f * knee + 0.01f;
float yg = 0.f;
@@ -561,6 +570,9 @@ comp_curve (AComp* self, float xg) {
} else {
yg = xg + (1.f / ratio - 1.f ) * (xg - thresdb + width / 2.f) * (xg - thresdb + width / 2.f) / (2.f * width);
}
+
+ yg += makeup;
+
return yg;
}
@@ -655,8 +667,8 @@ render_inline (LV2_Handle instance, uint32_t w, uint32_t max_h)
// maybe cut off at x-position?
const float x = w * (self->v_lvl_in + 60) / 60.f;
- //const float y = h * (self->v_lvl_out + 60) / 60.f;
- cairo_rectangle (cr, 0, h - x, x, h);
+ const float y = x + h*self->v_makeup;
+ cairo_rectangle (cr, 0, h - y, x, y);
if (self->v_ratio > 1.0) {
cairo_set_source (cr, pat);
} else {