expCurveA

description
Author: Remco van der Most
License: BSD
Github: sss/math/expCurveA.axo

Inlets

frac32buffer in

frac32 exp

Outlets

frac32buffer out

Parameters

frac32.s.map exp

int32 stack

Declaration
int i;
int32_t expo[32];
int dir;
Control Rate
int32_t inexpo = __SSAT(param_exp + inlet_exp, 27);
dir = inexpo > 0 ? 1 : -1;
inexpo = inexpo > 0 ? inexpo : -inexpo;
int32_t inv = (1 << 27) - inexpo;
Audio Rate
int dar;
dar = inlet_in > 0 ? 1 : -1;
int32_t pos = __SSAT(inlet_in, 28);
pos = pos > 0 ? pos : -pos;
if (dir > 0) {
  expo[0] = ___SMMUL(pos << 3, (inv + ___SMMUL(inexpo << 3, pos << 2)) << 2);
}
if (dir < 0) {
  expo[0] =
      ___SMMUL(((1 << 27) - pos) << 3,
               (inv + ___SMMUL(inexpo << 3, ((1 << 27) - pos) << 2)) << 2);
}
for (i = 1; i <= param_stack; i++)
  expo[i] = ___SMMUL(expo[i - 1] << 3,
                     (inv + ___SMMUL(inexpo << 3, expo[i - 1] << 2)) << 2);
if (dir > 0) {
  outlet_out = expo[param_stack] * dar;
}
if (dir < 0) {
  outlet_out = ((1 << 27) - expo[param_stack]) * dar;
}

Privacy

© 2024 Zrna Research