static void set2(t_limiter *x, t_floatarg limit, t_floatarg hold, t_floatarg release) { t_float lim = dbtorms(limit); x->val2->limit = (lim > x->val1->limit)?(x->val1->limit/lim):.5; x->val2->hold_samples = calc_holdsamples(hold, x->buf_size); x->val2->change_of_amplification = calc_coa(release); }
static void set_limit(t_limiter *x, t_floatarg limit) { if (limit < 0.00001) limit = 100; x->val1->limit = dbtorms(limit); if (x->val1->limit < x->cmp->treshold) x->cmp->treshold = x->val1->limit; set_uclimit(x); }
static void set_compressor(t_limiter *x, t_floatarg limit, t_floatarg treshold, t_floatarg ratio) { t_cmpctl *c = x->cmp; t_float lim = dbtorms(limit); t_float tresh = dbtorms(treshold); if ((limit == 0) && (treshold == 0) && (ratio == 0)) {set_mode(x, COMPRESS); return;} if (tresh > lim) tresh = lim; if (ratio < 0.) ratio = 1.; c->ratio = ratio; x->val1->limit = lim; c->treshold = tresh; set_uclimit(x); set_mode(x, COMPRESS); }
static void set_treshold(t_limiter *x, t_float treshold) { t_cmpctl *c = x->cmp; t_float tresh = dbtorms (treshold); if (tresh > x->val1->limit) tresh = x->val1->limit; c->treshold = tresh; set_uclimit(x); }
static void set1(t_limiter *x, t_floatarg limit, t_floatarg hold, t_floatarg release) { t_float lim = dbtorms(limit); x->val1->limit = (lim > 0)?lim:1; x->val1->hold_samples = calc_holdsamples(hold, x->buf_size); x->val1->change_of_amplification = calc_coa(release); if (lim < x->cmp->treshold) x->cmp->treshold = lim; set_uclimit(x); }
static void set_uclimit(t_limiter *x) { t_cmpctl *c = x->cmp; t_float limit = x->val1->limit, limitdB = rmstodb(limit), ratio = c->ratio, tresh = c->treshold, treshdB = rmstodb(tresh); c->climit_inverse = limit / tresh; c->uclimit = tresh / dbtorms(treshdB+(limitdB - treshdB)/ratio); c->treshdB = treshdB; c->oneminusratio = 1. - ratio; }
static void set_limits(t_limiter *x, t_floatarg limit1, t_floatarg limit2) { t_float lim1, lim2; if (limit1 < 0.00001) limit1 = 100; lim1 = dbtorms(limit1); lim2 = dbtorms(limit2); if (lim2 < lim1) { lim2 = 2*lim1; /* this is to prevent lim2 (which should trigger the FAST regulation) */ x->mode = 0; /* to underrun the SLOW regulation; this would cause distortion */ } x->val1->limit = lim1; x->val2->limit = lim1/lim2; if (lim1 < x->cmp->treshold) x->cmp->treshold = lim1; set_uclimit(x); }
float param2gain (float param) { return dbtorms(param2db(param)); }