table send cc

send data of a table as midi controler data.set the start of the range of the controlers to send with 'startcc',the length of the range with 'length'.useful for controllers capable of bi-directional midi,like 'livid base' or 'novation launchpad'.
Author: Robert Schirmer
License: BSD
Github: rbrt/midi/out/table send cc.axo

Inlets

int32 offset in the table

int32 startcc

bool32.rising redraw

bool32 active

Outlets

None

Parameters

bool32.tgl enable ctrl feedback

int32 offset

Attributes

objref table

combo device

combo blocksize

spinner channel

spinner startcc

spinner length

Declaration
int i;
int32_t v[128];
int32_t prev[128];
int ntrig[128];

int rtrig;

int32_t offset;
Init
{
  int i;
  for (i = 0; i < attr_length; i++)
    prev[i] = -666;
}
Control Rate
offset = inlet_offset + param_offset;

if (inlet_active || param_active) {
  {
    i += 1;
    if (i == attr_length)
      i = 0;
    v[i] = attr_table.array[__USAT(((i << attr_blocksize) + offset),
                                   attr_table.LENGTHPOW)]
           << attr_table.GAIN;

    if ((v[i] != prev[i]) && !ntrig[i]) {
      MidiSend3((midi_device_t)attr_device,
                MIDI_CONTROL_CHANGE + (attr_channel - 1),
                i + attr_startcc + inlet_startcc, (v[i] >> 20));
      prev[i] = v[i];
      ntrig[i] = 1;
    }
    if (v[i] == prev[i])
      ntrig[i] = 0;
  }
}

// re-init

if ((inlet_redraw > 0) && !rtrig) {
  rtrig = 1;
  {
    int ii;
    for (ii = 0; ii < attr_length; ii++)
      prev[ii] = -666;
  }
}
if (!(inlet_redraw > 0))
  rtrig = 0;

Privacy

© 2024 Zrna Research