IO Variants: 2
Variant: 1
frac32.bipolar Pitch input
frac32.bipolar Phase input
frac32.bipolar Pulse width modulation
bool32.rising Reset phase
frac32.positive PWM output
frac32.s.map.lfopitch Pitch
frac32.u.map.ratio Pulse width
uint32_t phase;
int32_t old_reset;
phase = 0;
old_reset = 0;
int32_t pulsewidth;
uint32_t phase2;
if (inlet_reset && !old_reset) {
phase = 0;
} else {
int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
phase += freq >> 2;
}
old_reset = inlet_reset;
pulsewidth = param_pw + inlet_pwm;
if (pulsewidth > (1 << 27)) {
pulsewidth = (1 << 27);
} else if (pulsewidth < 0) {
pulsewidth = 0;
}
phase2 = phase + (inlet_phase << 4);
if ((phase2 >> 5) > pulsewidth) {
outlet_pwm = 0;
} else {
outlet_pwm = (1 << 27) - 1;
}
Variant: 2
frac32.bipolar Pitch input
frac32.bipolar Phase input
frac32.bipolar Pulse width modulation
bool32.rising Reset phase
frac32.bipolar PWM output
frac32.s.map.lfopitch Pitch
frac32.u.map.ratio Pulse width
uint32_t phase;
int32_t old_reset;
phase = 0;
old_reset = 0;
int32_t pulsewidth;
uint32_t phase2;
if (inlet_reset && !old_reset) {
phase = 0;
} else {
int32_t freq;
MTOFEXTENDED(param_pitch + inlet_pitch, freq);
phase += freq >> 2;
}
old_reset = inlet_reset;
pulsewidth = param_pw + inlet_pwm;
if (pulsewidth > (1 << 27)) {
pulsewidth = (1 << 27);
} else if (pulsewidth < 0) {
pulsewidth = 0;
}
phase2 = phase + (inlet_phase << 4);
if ((phase2 >> 5) > pulsewidth) {
outlet_pwm = -(1 << 27);
} else {
outlet_pwm = (1 << 27) - 1;
}