holdmap

creates a table named like the object that can be referenced in the patcher and creates a 'map' of all notes currently held down,including velocities. no 'aftertouch'.
Author: robert schirmer
License: BSD
Github: rbrt/poly/holdmap.axo

Inlets

int32.positive note

int32.positive velo

Outlets

None

Declaration
uint8_t pren;
uint8_t prev;

static const uint8_t LENGTHPOW = 7;
static const uint8_t LENGTH = 1 << 7;
static const uint8_t LENGTHMASK = (1 << 7) - 1;
static const uint8_t BITS = 8;
static const uint8_t GAIN = 20;
uint8_t array[LENGTH];
Init
int i;
{
  for (i = 0; i < LENGTH; i++)
    array[i] = 0;
}
Control Rate
if ((inlet_note != pren) || (inlet_velo != prev)) {
  array[__USAT((inlet_note), LENGTHPOW)] = inlet_velo;
  pren = inlet_note;
  prev = inlet_velo;
}

Privacy

© 2024 Zrna Research