env ahd attr

mod of attack/hold/decay envelope, linear ramps. attack/decay times can be scaled with the attributes 'a' and 'd'. 'state' reflects the envelope's state. if 'attack' is zero,a very short slope defined by 'declick' is used,to avoid clicking
Author: Robert Schirmer
License: BSD
Github: rbrt/control/env ahd attr.axo

Inlets

bool32.risingfalling trigger

frac32.positive a

frac32.positive d

bool32.rising reset

Outlets

frac32.positive envelope output

bool32 state

Attributes

spinner ascale

spinner dscale

spinner declick

Declaration
int32_t val;
Init
val = 0;
Control Rate
if (inlet_gate > 0) {
  int32_t t;
  MTOF(-inlet_a, t);
  val += (inlet_a) ? t >> attr_ascale : 1 << (27 - attr_declick);
} else {
  int32_t t;
  MTOF(-inlet_d, t);
  val -= t >> attr_dscale;
}
val = __USAT(val, 27);
if (inlet_reset)
  val = 0;
outlet_env = val;
outlet_state = bool(val);

Privacy

© 2024 Zrna Research