step write 4

if the value at an inlet changes,it's written to the table at inlet 'step'. if 'rec' is on,after the values changes for the first time,it will be written to the table at inlet 'step' ALL THE TIME (if it changes or not...) useful for live-recording of modulation data.
Author: robert schirmer
License: BSD
Github: rbrt/seq/step write 4.axo

Inlets

int32.positive offset

int32.positive step

frac32 v0

frac32 v1

frac32 v2

frac32 v3

bool32.risingfalling rec

Outlets

None

Parameters

int32 offset

Attributes

objref table

Declaration
uint32_t prev0;
uint32_t prev1;
uint32_t prev2;
uint32_t prev3;

int ntrig0;
int ntrig1;
int ntrig2;
int ntrig3;
Init
prev0 = 0;
prev1 = 0;
prev2 = 0;
prev3 = 0;
Control Rate
if ((inlet_rec > 0) && (inlet_v0 != prev0))
  ntrig0 = 1;
if (!(inlet_rec > 0))
  ntrig0 = 0;
if ((inlet_rec > 0) && (inlet_v1 != prev1))
  ntrig1 = 1;
if (!(inlet_rec > 0))
  ntrig1 = 0;
if ((inlet_rec > 0) && (inlet_v2 != prev2))
  ntrig2 = 1;
if (!(inlet_rec > 0))
  ntrig2 = 0;
if ((inlet_rec > 0) && (inlet_v3 != prev3))
  ntrig3 = 1;
if (!(inlet_rec > 0))
  ntrig3 = 0;

if ((inlet_v0 != prev0) || (ntrig0 > 0)) {
  attr_table.array[inlet_offset + 0 + inlet_step] =
      __SSAT(inlet_v0, 28) >> attr_table.GAIN;
  prev0 = inlet_v0;
}
if ((inlet_v1 != prev1) || (ntrig1 > 0)) {
  attr_table.array[inlet_offset + 1 + inlet_step] =
      __SSAT(inlet_v1, 28) >> attr_table.GAIN;
  prev1 = inlet_v1;
}
if ((inlet_v2 != prev2) || (ntrig2 > 0)) {
  attr_table.array[inlet_offset + 2 + inlet_step] =
      __SSAT(inlet_v2, 28) >> attr_table.GAIN;
  prev2 = inlet_v2;
}
if ((inlet_v3 != prev3) || (ntrig3 > 0)) {
  attr_table.array[inlet_offset + 3 + inlet_step] =
      __SSAT(inlet_v3, 28) >> attr_table.GAIN;
  prev3 = inlet_v3;
}

Privacy

© 2024 Zrna Research