1shot_new

drives a phasor (saw-wave) for reading/writing data
Author: robert schirmer
License: BSD
Github: rbrt/testing/1shot_new.axo

Inlets

frac32.bipolar speed modulation

bool32.rising trigger playback

frac32.positive offset inside the table

frac32.positive length of the area to index,or loop end

frac32.positive position inside range on trigger

Outlets

frac32buffer.positive relative position inside table

int32 playhead position inside range in samples

int32 length of range in samples

frac32.bipolar total speed

bool32 playback state

Parameters

frac32.s.map speed ,+ 64 normal speed forward, - 64 backward

Attributes

objref table

Declaration
int32_t index;
int32_t re;
int32_t rs;
uint8_t shift;

int ntrig;

int32_t t_speed;
int32_t start;

bool play;
Init
// set 'shift factor' for storing the recording length/the sync output
shift = (27 - attr_table.LENGTHPOW);
Control Rate
t_speed = ((inlet_speed + param_speed) * (float)(1.0f / (1 << (27 - shift))));
start = ___SMMUL(inlet_range, inlet_startpoint) << 5;

re = (t_speed > 0) ? inlet_range - (1 << shift) : inlet_range;
rs = (t_speed > 0) ? start : start - (1 << shift);

if (inlet_play && (!ntrig)) {
  ntrig = 1;
  index = (t_speed < 0) ? inlet_range : start;
  play = 1;
} else if (!(inlet_play > 0))
  ntrig = 0;

outlet_spos = ((index >> shift) > 0) ? (index >> shift) : 0;
outlet_stotal = inlet_range >> shift;
outlet_speed = inlet_speed + param_speed;
outlet_play = play;
Audio Rate
if ((index > re) || (index < rs))
  play = 0;

outlet_pos = __USAT((index + inlet_offset), 27);

if (play)
  index += t_speed;
else
  outlet_pos = 0;

Privacy

© 2024 Zrna Research