decay

Author: Smashed Transistors
License: LGPL
Github: tiar/ADD16/decay.axo

Inlets

bool32.rising trig

Outlets

None

Attributes

objref ctlAmp

objref sl16s

Declaration
static const uint32_t NBH = 16;
int32_t g[NBH];
int32_t gf[NBH];
bool atrig;

uint32_t getGain(int h) { return gf[h]; }
Init
for (int h = 0; h < NBH; h++) {
  g[h] = gf[h] = 0;
  atrig = false;
}
Control Rate
if (inlet_trig && !atrig) {
  for (int h = 0; h < NBH; h++) {
    g[h] = attr_ctlAmp.getGain(h);
  }
}
atrig = inlet_trig;
/*
            int32_t in = - inlet_d - param_d;
      int32_t c;
      MTOFEXTENDED(in, c);
      c = 0x7FFFFFFF - (c >> 2);
      val = ___SMMUL(val, c)<<1;
*/
int32_t f;
for (int h = 0; h < NBH; h++) {
  MTOFEXTENDED(-attr_sl16s.get(h), f);
  g[h] = ___SMMLS(g[h], f, g[h]);
  gf[h] =
      ___SMMLA(g[h] - gf[h], 0x40000000, gf[h]); // simple LP to limit clicks
}

Privacy

© 2024 Zrna Research