Bypass processing of parts of code in Faust?
-
I have an effect in Faust and if I add three svf eqs in a series, the processor usage goes up. I would like to be able to disable this for when these filters are not used. I can set ba.if to check if the gain is != 0, and that reduces the hit a little bit, but it's nowhere near as when the svfs aren't in the chain.
Ba.if docs say that select2 is strict (always evaluating both branches) -- is there a way to branch based on condition so that it bypasses processing of these eqs entirely when they're not used?
It would be easy to take things apart and rely on HISE to do the branching in scriptnode as it does that very well, but unfortunately in this case I need all the code in a single .dsp file for Faust.
@sletz any ideas? Thank you
-
This is the role of the new
ondemand
primitive, just announced at IFC 24 see: https://www.youtube.com/watch?v=zli5sFc5dlE.Not yet in the official Faust release but can be tested in this custom Faust IDE: https://orlarey.github.io/faustide/
-
@sletz thanks for that!
the relevant bit is at the end in The Future of Faust. I was curious about the enable primitive and even though it's undocumented, it seems to work!
It's somewhat limited in usage so looking forward to trying out ondemand.