diff options
author | Johannes Mueller <github@johannes-mueller.org> | 2017-08-15 21:23:44 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-06-20 21:06:16 +0200 |
commit | a0a4db47a76da788096e3a93c3824d56c8e804b5 (patch) | |
tree | a38d1cb4ee580e7e0195ec30099fe2b47495bfd3 /libs/plugins/a-comp.lv2/a-comp.c | |
parent | f647ac7daea3d5ae8bfb2903bff67fffcc6197df (diff) |
Add a control port to a-comp select which mode to display inline
Diffstat (limited to 'libs/plugins/a-comp.lv2/a-comp.c')
-rw-r--r-- | libs/plugins/a-comp.lv2/a-comp.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libs/plugins/a-comp.lv2/a-comp.c b/libs/plugins/a-comp.lv2/a-comp.c index f78dda558b..41f435dc19 100644 --- a/libs/plugins/a-comp.lv2/a-comp.c +++ b/libs/plugins/a-comp.lv2/a-comp.c @@ -51,8 +51,10 @@ typedef enum { ACOMP_GAINR, ACOMP_INLEVEL, ACOMP_OUTLEVEL, + ACOMP_SIDECHAIN, ACOMP_ENABLE, + ACOMP_FULL_INLINEDISP, ACOMP_A0, ACOMP_A1, @@ -72,8 +74,10 @@ typedef struct { float* gainr; float* outlevel; float* inlevel; + float* sidechain; float* enable; + float* full_inline_display; float* input0; float* input1; @@ -105,6 +109,8 @@ typedef struct { float v_lvl_out; float v_state_x; + bool v_full_inline_display; + float v_peakdb; uint32_t peakdb_samples; #endif @@ -177,6 +183,9 @@ connect_port(LV2_Handle instance, case ACOMP_ENABLE: acomp->enable = (float*)data; break; + case ACOMP_FULL_INLINEDISP: + acomp->full_inline_display = (float*)data; + break; default: break; } @@ -330,6 +339,12 @@ run_mono(LV2_Handle instance, uint32_t n_samples) acomp->v_makeup = makeup; acomp->need_expose = true; } + + bool full_inline = *acomp->full_inline_display > 0.5; + if (full_inline != acomp->v_full_inline_display) { + acomp->v_full_inline_display = full_inline; + acomp->need_expose = true; + } #endif float in_peak_db = -160.f; @@ -503,6 +518,12 @@ run_stereo(LV2_Handle instance, uint32_t n_samples) acomp->v_makeup = makeup; acomp->need_expose = true; } + + bool full_inline = *acomp->full_inline_display > 0.5; + if (full_inline != acomp->v_full_inline_display) { + acomp->v_full_inline_display = full_inline; + acomp->need_expose = true; + } #endif float in_peak_db = -160.f; @@ -908,8 +929,8 @@ render_inline (LV2_Handle instance, uint32_t w, uint32_t max_h) AComp* self = (AComp*)instance; uint32_t h = MIN (w, max_h); - if (w < 200) { - h = 40; + if (w < 200 && !self->v_full_inline_display) { + h = MIN (40, max_h); } if (!self->display || self->w != w || self->h != h) { @@ -921,7 +942,7 @@ render_inline (LV2_Handle instance, uint32_t w, uint32_t max_h) cairo_t* cr = cairo_create (self->display); - if (w >= 200) { + if (w >= 200 || self->v_full_inline_display) { render_inline_full (cr, self); } else { render_inline_only_bars (cr, self); |