diff options
author | Johannes Mueller <github@johannes-mueller.org> | 2017-08-03 21:14:56 +0200 |
---|---|---|
committer | Johannes Mueller <github@johannes-mueller.org> | 2018-05-12 19:49:18 +0200 |
commit | 0bc5a6f8e96f26a44702a764b52b025834e9eb86 (patch) | |
tree | fdb35b51f64db605d6d0a44530d697fead787dec | |
parent | 2a5d56215cbe0f86d649394168b6869946508a21 (diff) |
Make a-expander react probably on being disabled and enabled.
-rw-r--r-- | libs/plugins/a-exp.lv2/a-exp.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libs/plugins/a-exp.lv2/a-exp.c b/libs/plugins/a-exp.lv2/a-exp.c index 553edbdf21..c2b289777f 100644 --- a/libs/plugins/a-exp.lv2/a-exp.c +++ b/libs/plugins/a-exp.lv2/a-exp.c @@ -85,6 +85,8 @@ typedef struct { float makeup_gain; float tau; + bool was_disabled; + #ifdef LV2_EXTENDED LV2_Inline_Display_Image_Surface surf; bool need_expose; @@ -274,7 +276,7 @@ run_mono(LV2_Handle instance, uint32_t n_samples) float Lgain = 1.f; float Lxg, Lyg; float current_gainr; - float old_gainr = *aexp->gainr; + float old_gainr; int usesidechain = (*(aexp->sidechain) <= 0.f) ? 0 : 1; uint32_t i; @@ -295,6 +297,15 @@ run_mono(LV2_Handle instance, uint32_t n_samples) thresdb = 0.f; makeup = 0.f; makeup_target = 1.f; + if (!aexp->was_disabled) { + *aexp->gainr = 0.f; + aexp->was_disabled = true; + } + } else { + if (aexp->was_disabled) { + *aexp->gainr = 160.f; + aexp->was_disabled = false; + } } #ifdef LV2_EXTENDED @@ -319,6 +330,7 @@ run_mono(LV2_Handle instance, uint32_t n_samples) } #endif + old_gainr = *aexp->gainr; aexp->v_gainr = 0.0; for (i = 0; i < n_samples; i++) { @@ -434,6 +446,15 @@ run_stereo(LV2_Handle instance, uint32_t n_samples) thresdb = 0.f; makeup = 0.f; makeup_target = 1.f; + if (!aexp->was_disabled) { + *aexp->gainr = 0.f; + aexp->was_disabled = true; + } + } else { + if (aexp->was_disabled) { + *aexp->gainr = 160.f; + aexp->was_disabled = false; + } } #ifdef LV2_EXTENDED @@ -458,6 +479,7 @@ run_stereo(LV2_Handle instance, uint32_t n_samples) } #endif + old_gainr = *aexp->gainr; aexp->v_gainr = 0.0; for (i = 0; i < n_samples; i++) { |