play

play audio from table (non-transposed), starting from position
Author: Johannes Taelman
License: BSD
Github: table/play.axo

Inlets

frac32.positive start position in table

bool32.rising start playback

bool32.rising stop playback

Outlets

frac32buffer wave

Attributes

objref table

Declaration
int pstart;
int pstop;
int pos;
Init
pos = 0;
pstart = 0;
pstop = 1;
Control Rate
if ((inlet_start > 0) && !pstart) {
  pstart = 1;
  pstop = 0;
  uint32_t asat = __USAT(inlet_pos, 27);
  pos = asat >> (27 - attr_table.LENGTHPOW);
} else if (!(inlet_start > 0)) {
  pstart = 0;
}
if ((inlet_stop > 0) && !pstop) {
  pstop = 1;
  pstart = 0;
}
Audio Rate
if (!pstop) {
  if (pos < attr_table.LENGTH)
    outlet_wave = attr_table.array[pos++] << attr_table.GAIN;
  else
    outlet_wave = 0;
} else
  outlet_wave = 0;

Privacy

© 2024 Zrna Research