summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-07-04 14:26:37 +0200
committerRobin Gareus <robin@gareus.org>2016-07-04 14:26:37 +0200
commitd2f20120b762b1ad6bd19efaa66579e80ab387ca (patch)
tree568831ff35dc586484a4d4de2a4d0dfa01deea15 /libs
parent49294644fb19eee6a00a35383f673f7489ce51d3 (diff)
display level in a-comp display
Diffstat (limited to 'libs')
-rw-r--r--libs/plugins/a-comp.lv2/a-comp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libs/plugins/a-comp.lv2/a-comp.c b/libs/plugins/a-comp.lv2/a-comp.c
index f3fde7d53d..3f78b86d89 100644
--- a/libs/plugins/a-comp.lv2/a-comp.c
+++ b/libs/plugins/a-comp.lv2/a-comp.c
@@ -269,13 +269,13 @@ run(LV2_Handle instance, uint32_t n_samples)
acomp->old_yg = Lyg;
}
- *(acomp->outlevel) = (max == 0.f) ? -45.f : to_dB(max);
+ *(acomp->outlevel) = (max < 0.0056f) ? -45.f : to_dB(max);
#ifdef LV2_EXTENDED
- // XXX Lyg is not correct, we need input-level filtered by attack/release
- if (fabsf (acomp->v_lvl - Lyg) >= 1) { // quantize to 1dB difference
+ const float v_lvl = (max < 0.001f) ? -60.f : to_dB(max);
+ if (fabsf (acomp->v_lvl - v_lvl) >= 1) { // quantize to 1dB difference
acomp->need_expose = true;
- acomp->v_lvl = Lyg;
+ acomp->v_lvl = v_lvl;
}
if (acomp->need_expose && acomp->queue_draw) {
acomp->need_expose = false;
@@ -390,8 +390,10 @@ render_inline (LV2_Handle instance, uint32_t w, uint32_t max_h)
cairo_clip (cr);
// draw signal level
- const float x = w * (self->v_lvl + 60) / 60.f;
- cairo_rectangle (cr, 0, 0, x, h);
+ // TODO add a gradient pattern above threshold
+ // maybe cut off at x-position?
+ const float y = h * (self->v_lvl + 60) / 60.f;
+ cairo_rectangle (cr, 0, h - y, w, y);
cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
cairo_fill (cr);