holdmap sdram toggle

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 sdram toggle.axo

Inlets

int32.positive note

int32.positive velo

bool32.risingfalling toggle

Outlets

None

Attributes

spinner toggle

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;
Init
static uint8_t _array[attr_poly][LENGTH] __attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
{
  int i;
  for (i = 0; i < LENGTH; i++)
    array[i] = 0;
}
Control Rate
if ((inlet_note != pren) || (inlet_velo != prev)) {
  if (attr_toggle || inlet_toggle) {
    if (inlet_velo)
      (array[__USAT((inlet_note), LENGTHPOW)]) =
          !(array[__USAT((inlet_note), LENGTHPOW)]);
  } else
    (array[__USAT((inlet_note), LENGTHPOW)]) = inlet_velo;
  pren = inlet_note;
  prev = inlet_velo;
}

Privacy

© 2024 Zrna Research