enc left 2

Author: Robert Schirmer
License: BSD
Github: rbrt/push/enc left 2.axo

Inlets

None

Outlets

frac32.positive v

Declaration
int8_t vel;
int32_t ntrig;
int inc;
int32_t out;
Init
vel = 0;
ntrig = 0;
Control Rate
if (ntrig) {
  inc = (vel << 21);
  out = __SSAT((out + inc), 28);
  if (out < 0)
    out = 0;
}
outlet_v = out;
ntrig = 0;
Midi Handler
if ((status & 0xF0) == MIDI_CONTROL_CHANGE) {

  if (data1 == 15) {
    if (data2 & 0x40)
      vel = (128 - data2) * -1;
    else
      vel = data2;
    ntrig = 1;
  }
}

Privacy

© 2024 Zrna Research