Hey team, really loving the collaboration here! I’m trying to assign a knob to the Distortion.hardclip amount in the Distortion effect of one of my layer’s busses, but having trouble figuring out how to set the parameter correctly. Any help is appreciate!
This is what I came up with looking at the examples here, but it’s not working .
effects = this.program:findEffects(true)
distEffect = effects[1]
function onBoostChange()
newDist = DIST_AMOUNT
distEffect:setParameter("Distortion.hardclip", newDist)
end
defineParameter("DIST_AMOUNT","DIST_AMOUNT",0,0,100,1,onBoostChange)
The parameter name should be “hardclip” not “Distortion.hardclip”.
Once you change this it should work.
You could also use the name of the effect as second argument of findEffects(). Otherwise if you change the order of effects or add some effects to Program Bus the Distortion might not be the first effect returned by findEffects().
effects = this.program:findEffects(true, "Distortion")
distEffect = effects[1]
function onBoostChange()
distEffect:setParameter("hardclip", DIST_AMOUNT)
end
defineParameter("DIST_AMOUNT","DIST_AMOUNT",0,0,100,1,onBoostChange)
There are several ways how to do this. I would probably do something like this:
function onBoostChange()
local distEffect = this.parent:getBus():getEffect("Distortion")
if distEffect then
distEffect:setParameter("hardclip", DIST_AMOUNT)
end
end
defineParameter("DIST_AMOUNT","DIST_AMOUNT",0,0,100,1,onBoostChange)
Put everything inside the callback function. The if statement is there to guard against script errors. If it finds the effect it sets the parameter, if not then nothing happens.
On the other hand if you’re sure you won’t change the structure of the program tree (adding more effects or reorder them) the first option might be a bit more efficient. It doesn’t look for the effect each time you change the DIST_AMOUNT parameter. Only looks for the effect when the script is loaded.
Thanks misohoza, that did the trick! I’ve read a lot of your posts here and really appreciate your willingness to share.
So is there a reference somewhere that lists the names and addresses of each component in Halion and how to address them? For example this hardclip parameter I found the name for by first connecting the knob to the macro page and then going into the macro page to see what came up as available to connect a knob to.
And is there some reference that then helps explain the tree that these components live in, for example “this.parent:getBus():getEffect(“Distortion”)”. This seems a bit esoteric unless you know what you are looking for. But I never would have figured that out looking at the manual, as it doesn’t really explain that process that I could find, and it seems there are multiple ways to do it as well.
You can read the parameter names in Parameter List. Some of them are organised in folders. In that case you address them by “Folder.parameter” (for example “Filter.Cutoff”, “Filter.Resonance”). Otherwise just use the parameter name as it appears in Parameter List. Special category are modulation matrix parameters. First you need to address the modulation matrix row by getModulationMatrixRow ()
Don’t know why but this method is not working in my case. I want to control SendGain parameter of “AUX FX 1” effect on a bus number 3. I get an alert “attempt to index a nil value” in a line local Effect = this.parent:getBus(3):getEffect(“AUX FX 1”)
function ReverbChange()
local Effect = this.parent:getBus(3):getEffect("AUX FX 1")
if Effect then
Effect:setParameter("SendGain", reverb_slider)
end
end
I suspect this happens because bus #3 is inlaid deeper than the program bus. But I don’t know how to point to it in this case.
IN the parent layer I have only two buses, the other (#3,4,5) reside in the deeper level. And that’s the problem why the string this.parent:getBus(3):getEffect(“AUX FX 1”) can not find it. How can I apply the same method (getting the effect by name rather than by slot number) in the case of inlaid buses?