tedit 4 b

view and edit 4 elements of a table. 'offset' changes the start to display/edit from.
Author: Robert Schirmer
License: BSD
Github: rbrt/data/tedit 4 b.axo

Inlets

int32 offset

Outlets

None

Parameters

frac32.s.map b0

frac32.s.map b1

frac32.s.map b2

frac32.s.map b3

Attributes

objref table

Declaration
int32_t prev[4];
int32_t prevp[4];

bool changed;

int i;
int32_t padr;
Init
changed = 0;
Control Rate
if (attr_table.array[i + inlet_offset] != prev[i]) {
  changed = 1;
  prev[i] = attr_table.array[i + inlet_offset];
}
if (inlet_offset != padr) {
  changed = 1;
  padr = inlet_offset;
}

if (changed) {
  changed = 0;
  PExParameterChange(
      &parent->PExch[PARAM_INDEX_attr_legal_name_b0],
      attr_table.array[__USAT((inlet_offset + 0), attr_table.LENGTHPOW)]
          << attr_table.GAIN,
      0xFFFD);
  PExParameterChange(
      &parent->PExch[PARAM_INDEX_attr_legal_name_b1],
      attr_table.array[__USAT((inlet_offset + 1), attr_table.LENGTHPOW)]
          << attr_table.GAIN,
      0xFFFD);
  PExParameterChange(
      &parent->PExch[PARAM_INDEX_attr_legal_name_b2],
      attr_table.array[__USAT((inlet_offset + 2), attr_table.LENGTHPOW)]
          << attr_table.GAIN,
      0xFFFD);
  PExParameterChange(
      &parent->PExch[PARAM_INDEX_attr_legal_name_b3],
      attr_table.array[__USAT((inlet_offset + 3), attr_table.LENGTHPOW)]
          << attr_table.GAIN,
      0xFFFD);
}

if (prevp[0] != param_b0) {
  attr_table.array[inlet_offset + 0] = param_b0 >> attr_table.GAIN;
  prevp[0] = param_b0;
}
if (prevp[1] != param_b1) {
  attr_table.array[inlet_offset + 1] = param_b1 >> attr_table.GAIN;
  prevp[1] = param_b1;
}
if (prevp[2] != param_b2) {
  attr_table.array[inlet_offset + 2] = param_b2 >> attr_table.GAIN;
  prevp[2] = param_b2;
}
if (prevp[3] != param_b3) {
  attr_table.array[inlet_offset + 3] = param_b3 >> attr_table.GAIN;
  prevp[3] = param_b3;
}

i++;
i = i % 4;

Privacy

© 2024 Zrna Research