polyslave

works only inside a polyphonic sub-patch. routes note and velocity to a specific voice, and gives feedback to the 'mother-object' about the current playback state of that voice. inlet 'envstate' provides 'polyhandler slave' with information about the state of a release-envelope if there is one. otherwise ,'polyhandler slave' will work without
Author: robert schirmer
License: BSD
Github: rbrt/poly/polyslave.axo

Inlets

bool32.rising stop

frac32.positive envstate

Outlets

int32.positive note

int32.positive velo

bool32 gate

bool32.pulse retrig

Attributes

objref polymaster

Declaration
uint8_t pren;
uint8_t prev;
uint8_t velon;
bool gate;
uint8_t index;
bool stop;
bool trigon;
bool trigoff;
uint8_t note;
uint8_t velo;
Init
index = parent->polyIndex;
pren = 0;
prev = 0;
Control Rate
outlet_retrig = 0;
trigon = 0;
trigoff = 0;

note = attr_polymaster.Snote[index] - 1;
velo = attr_polymaster.Svelo[index];
if ((note != pren) || (velo != prev) || (stop && velo)) {
  stop = 0;
  pren = note;
  prev = velo;
  if (prev) {
    trigon = 1;
    velon = prev;
    if (inlet_envstate)
      outlet_retrig = 1;
  } else
    trigoff = 1;
}

if (trigon && !gate)
  gate = 1;
if (trigoff && gate)
  gate = 0;
if (inlet_stop && !stop) {
  gate = 0;
  stop = 1;
  attr_polymaster.Svelo[index] = 0;
  attr_polymaster.Rhold[index] = 0;
}

if (inlet_envstate)
  attr_polymaster.Rrelease[index] = pren + 1;
else
  attr_polymaster.Rrelease[index] = 0;

outlet_gate = gate;
outlet_note = pren;
outlet_velo = velon;

Privacy

© 2024 Zrna Research