Why isn't this set parameter for a DSPNetwork node working?
-
Here's the snippet:
HiseSnippet 1703.3oc4XstaaaCEVxIps1qEncn.a8eDFCsN.YI1cscEHWZtX6Ui03XDkFz+EvJQGSDZRAQJG6Mzmr828.rGk8Frcnnt4X2rDis1MLEfXQdtvOd34FEYrhv8I9mJ4zf.hxxxdodgBOhTJBsrKe7j.hk8ccbmvUC1e.lxs5zzx9dNmQTRhJ.GhGZs2j.rTR7srsW5GzrXWdYq3me+U6gYXtGIeJKqSDTOxanCop7Y6syORYr1XexwzgE39Y6zwSv2WvDQ.bVxotU.16b7YjtXMakbrruUKepRD5pvJhD3YOg+D2AhK3F9OgJoumQzCZX4BJxLs09CnL+rspD13NE13KY13Oz4.pOMa9bCv8iIfxknnMvtzUAoF2.HYW.RKafzCbb8BoApbJZ77ENc3JRXeLXpKBECuVkdSIm8E.Gb0ZCwmSZGBCxjn1KpWeUD7uU1nREJmQ4DT+HtmhJ3HyA8oCm.tHjwmFehS.AqsRketRYlvCyPbh5BQ34nsPs3mARuFHTSYPWyzGQ5SBIfSPspF3vE9DTrGEQRkjvFUWsZN6UATffGipiWzXA1JcYzZu1SxH7jo3GL3JCHAAx3QKRuLj+jblREFLNRAirVPHkqpkSWK3IXVDo1JIblqSoFFET0pn5q87aj99PkJeby6FYGABdWghbH2XxAoPWlT+9ykl9HOTvXomVWhrNTK7pDrFOZ36IgqhFogbFifu3zN32554f6Y7.Kvnf2gSUGFPRF2Vv70Nt52mMbvJwEFd6scZhUXcDRxb.eAjPEUCG6ljQPJFS7RYmlD44JQ.jjYlfIHLV3Gwvpois0IwRH.1ioBnzAMbIUMoXRtaP.e8qLf+5BwG3zip7FLeLVZNXDrT+Sfwjzj2yoU+9DOUN.W1o86VzbhW+kub5xaxqDmRId4ejyGISyUTq52tt0pBt10pRx9ZupyMI35REzV95EbMsOaA9mSYka8YnR2eON9eFiMmpXb4TL5RGFvHs3iHLHATLF+RHiSebDSkN6zdcGH3hfABN0qni1QDUH8ryHgEw9b2P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p64Zg5kXgjE+dY9hHHl.MpfR+vFUrrlww+Qy0we7PVlqu8u3r4qfIPiLcjrUUnHSUDzGgvGb11p5aOt829xpuZ6JU1LuJy1UPn7gnz5daUstV3zxdI5JslVB07RZF5wedtrmNM2pZdAxpnB5c8sqr45Ewfk0eBPccflA
Here's the code:
Content.makeFrontInterface(600, 600); inline function getset_my_snex_parameter() { local network = Engine.getDspNetworkReference("Scriptnode Synthesiser1","DspNetwork"); local snex_node = network.get('snex_node'); local test_param = snex_node.getParameter('test_param'); Console.print(test_param.getValue()); snex_node.set('test_param', 0.5); Console.print(test_param.getValue()); } getset_my_snex_parameter();
According to the docs:
DspNetwork.get(var id) returns a reference to a node with the same id.
Node.set(var id, var value) sets the property of the node.I believe this is what I'm doing. But the test_param never gets set to 0.5, and indeed the console prints 0.0 twice.
Is there an undocumented call I should be using?
-
@Christoph-Hart
Hey dude, is this a bug or am I just doing it wrong? -
Any thoughts folks? I'm either incredibly dumb and need it pointing out to me in the most brutal way (I can take it!) orrrrr there really does seem to be a bug here.
I do notice in my data view, the network gets retrieved and produces a value. But the node and test_param doesn't:
This is what I get when I take everything out of the function and set it to const rather than local.
-
I figured this out, only a year and a half late
reg network = Engine.getDspNetworkReference(PROCESSOR_ID, "network_name"); network.setParameterDataFromJSON({"PARAMETER_NAME_STR": new_value});
Or for an example:
reg network = Engine.getDspNetworkReference("Script FX1", "dspnetwork"); network.setParameterDataFromJSON({"GainVolume": 0.9});
I'm using it in the callback of a combo box in order to set a parameter value, and it is working here.
-
@Orvillain I reckon using this prevents to compile the network because then, anything node or network related can't be accessed from the interface script, I am right?
-
This would also work:
https://docs.hise.dev/scripting/scripting-api/parameter/index.html#setvalueasync
In your original post you were mixing up Properties and Parameters. The
set()
function modifies properties.I reckon using this prevents to compile the network because then, anything node or network related can't be accessed from the interface script, I am right?
Yup. Once you compile this, the scriptnode API goes out the window. You can of course use a high-level interpreted network where you load in your compiled networks if you want to keep dynamic access to properties / parameters.
-
@Christoph-Hart said in Why isn't this set parameter for a DSPNetwork node working?:
You can of course use a high-level interpreted network where you load in your compiled networks if you want to keep dynamic access to properties / parameters.
oh yeah, haven't though about that
-
@ustk Yeah you're right. That's fine for my purposes right now, as I'm just blasting out a quick prototype for my delay plugin to send to a mate.