faust
faust copied to clipboard
Expressions in control() get optimised inappropriately
Expressions inside control get combined with identical expressions elsewhere. This is the same optimisation Faust usually performs; however in this case it is wrong, as expressions inside control should only be evaluated (and their values updated) when their trigger is set. This affects all kinds of expressions but particularly recursive ones.
import("stdfaust.lib");
process = control(ba.time, ba.pulse(2)); // as expected, only increments every second sample: 0, 0, 1, 1, 2, 2, ...
import("stdfaust.lib");
process = (ba.time * 10) + control(ba.time, ba.pulse(2)); // both 'ba.time's are updated every sample: 0, 11, 22, 33, 44, ...