Macro Control for ScriptNode
-
@toxonic But then you will not be able to use macros too even if at some glorious day in the future it might be added (spoiler alert: it won't).
You need to think of compiled networks as black boxes with no outside connections except for the parameters and external data slots.
-
@Christoph-Hart Ah, okay, i see! :-) Well, i think, I'll find another solution.
I have several Faust effects, that depend on the Tempo from the DAW and which should be dynamically loaded into Hardcoded Master FX slots.
But i guess, I can figure out, how to assign the "bpm" knobs of the FX dynamical to the Transport Handler tempoChange function.... -
As it seems, I don't get it working...
I can't figure out, why I am not able to pass a component (knob, ...) to an inline function.
I seem to have a deep misunderstanding of what's going on there.
Can someone help, please?const var Knob1 = Content.getComponent("Knob1"); const TH = Engine.createTransportHandler(); inline function tempoChange(newTempo) // <-- trying inline function tempoChange(component, newTempo) doesn't work... { //component.setValue(newTempo); } TH.setOnTempoChange(SyncNotification, tempoChange);```
-
EDIT: OOOOPS --- this is NOT WORKING!
Okay, sorry... figured it out! :-)
Content.makeFrontInterface(600, 500); const var Tempo = [Content.getComponent("Knob4"), Content.getComponent("Knob3"), Content.getComponent("Knob2"), Content.getComponent("Knob1")]; const var th = Engine.createTransportHandler(); for (x in Tempo) { th.setOnTempoChange(false, function(newTempo) { x.set("text", newTempo + " BPM"); }); }�
-
This post is deleted! -
@toxonic said in Macro Control for ScriptNode:
for (x in Tempo) { th.setOnTempoChange(false, function(newTempo) { x.set("text", newTempo + " BPM"); }); }
You only have one
th
variable, so setting it's callback multiple times (as you are doing in your loop) does not make sense.I also don't think
x
will be available inside the callback function. -
@d-healey Yeah, i don't know, what was wrong with me....
Maybe you have an idea? -
@toxonic Your first idea looked correct, just use a function instead of an inline function.
-
@d-healey But won't I need to use an inline function for realtime?
What about using the loop inside the function? It seems to work, uh?Content.makeFrontInterface(600, 500); const var Tempo = [Content.getComponent("Knob4"), Content.getComponent("Knob3"), Content.getComponent("Knob2"), Content.getComponent("Knob1")]; const var th = Engine.createTransportHandler(); th.setOnTempoChange(false, function(newTempo) { for (x in Tempo) x.setValue(newTempo); });
-
But won't I need to use an inline function for realtime?
No, and also your UI script should be deferred (non-realtime) anyway. I think all callback functions (except control callbacks) are non-inline.
Yeah a loop inside the function is fine. You might want to reverse the order of controls in your array, it seems strange that element 3 is knob 1, but it won't affect the functionality.