int32 Buffer init value for current buffer
int32 If current_buffer and (bitwise operator) trig_mask > 0 then output pulse
bool32.rising Tempo entry
frac32.positive Random entry
int32 Buffer init value of current buffer
frac32.bipolar Output note
bool32 Output pulse when current_buffer and (bitwise operator) trig_mask > 0
bool32 o2
uint8_t ntrig;
uint8_t buffer;
uint8_t newbit;
uint8_t counter;
uint8_t initvalue;
uint8_t bufferinitvalue;
ntrig = 0;
buffer = 1;
counter = 0;
initvalue = 0;
bufferinitvalue = 0;
outlet_o = 0;
outlet_o2 = 0;
if (inlet_trig > 0 && !ntrig) {
ntrig = 1;
if ((counter % 8) == 0) {
bufferinitvalue = buffer;
counter = 0;
if (inlet_initvalue != initvalue) {
buffer = (uint8_t)inlet_initvalue;
initvalue = (uint8_t)inlet_initvalue;
}
}
counter++;
if ((GenerateRandomNumber() % 255) < (inlet_random >> 19)) {
newbit = ~buffer & 0x1;
} else {
newbit = buffer & 0x1;
}
buffer = (buffer >> 1) | (newbit << 7);
} else {
if ((inlet_trigmask & buffer) > 0)
outlet_o = 1; // Pour maintenir la note jusqu'au prochain trig
if (buffer & 1)
outlet_o2 = 1;
}
if (!(inlet_trig > 0))
ntrig = 0;
outlet_note = buffer << 19;
outlet_initvalue = bufferinitvalue;