-#ifdef LV2_EXTENDED
- acomp->v_lvl += .1 * (in_peak - acomp->v_lvl) + 1e-12; // crude LPF TODO use n_samples/rate TC
- if (!isfinite_local (acomp->v_lvl)) {
- acomp->v_lvl = 0.f;
- }
- const float v_lvl_in = (acomp->v_lvl < 0.001f) ? -60.f : to_dB(acomp->v_lvl);
- const float v_lvl_out = (max < 0.001f) ? -60.f : to_dB(max);
- if (fabsf (acomp->v_lvl_out - v_lvl_out) >= 1 || fabsf (acomp->v_lvl_in - v_lvl_in) >= 1) {
- // >= 1dB difference
- acomp->need_expose = true;
- acomp->v_lvl_in = v_lvl_in;
- acomp->v_lvl_out = v_lvl_out - to_dB(makeup_gain);
- }
- if (acomp->need_expose && acomp->queue_draw) {
- acomp->need_expose = false;
- acomp->queue_draw->queue_draw (acomp->queue_draw->handle);
- }
-#endif
-}
-
-static void
-run_stereo(LV2_Handle instance, uint32_t n_samples)
-{
- AComp* acomp = (AComp*)instance;
-
- const float* const input0 = acomp->input0;
- const float* const input1 = acomp->input1;
- const float* const sc = acomp->sc;
- float* const output0 = acomp->output0;
- float* const output1 = acomp->output1;
-
- float srate = acomp->srate;
- float width = (6.f * *(acomp->knee)) + 0.01;
- float cdb=0.f;
- float attack_coeff = exp(-1000.f/(*(acomp->attack) * srate));
- float release_coeff = exp(-1000.f/(*(acomp->release) * srate));
-
- float max = 0.f;
- float lgaininp = 0.f;
- float rgaininp = 0.f;
- float Lgain = 1.f;
- float Lxg, Lxl, Lyg, Lyl, Ly1;
- int usesidechain = (*(acomp->sidechain) <= 0.f) ? 0 : 1;
- uint32_t i;
- float ingain;
- float in0;
- float in1;
- float sc0;
- float maxabslr;
-
- float ratio = *acomp->ratio;
- float thresdb = *acomp->thresdb;
- float makeup = *acomp->makeup;
- float makeup_target = from_dB(makeup);
- float makeup_gain = acomp->makeup_gain;
-
- const float tau = acomp->tau;
-
- if (*acomp->enable <= 0) {
- ratio = 1.f;
- thresdb = 0.f;
- makeup = 0.f;
- makeup_target = 1.f;
- }