Greetings,
I’m running into a performance issue with one of my scripts. I have each key sampled separately for an instrument leading to a lot of zones. It works fine until I get into Halion Sonic 3 and load up 4 layers with my instrument and then tweak the knobs that are running code similar to below. I get crackles until I increase the buffer size when changing parameters in my macro designer with the knobs that have code similar to the below. Is there a more efficient way to set a parameter across all zones in a script other than doing a loop?
-- remap the LFO1 cutoff depth from -100 to 100 to 0 to 100
function onParamCutoffDepthChanged()
elements = this.program:findChildren(true)
for i, element in ipairs(elements) do
if type(element) == "Zone" then
--print(element.name)
--print(element:getModulationMatrixRow(2).rowNumber)
if element:getModulationMatrixRow(2):hasParameter("Destination.Depth") then
element:getModulationMatrixRow(2):setParameter("Destination.Depth",paramCutoffDepth)
end
end
end
end
-- remap the LFO2 pitch depth from -100 to 100 to 0 to 100
function onParamPitchDepthChanged()
elements = this.program:findChildren(true)
for i, element in ipairs(elements) do
if type(element) == "Zone" then
if element:getModulationMatrixRow(1):hasParameter("Destination.Depth") then
element:getModulationMatrixRow(1):setParameter("Destination.Depth",paramPitchDepth)
end
end
end
end
I hope there is a better way of doing this so I can keep the instrument running at low buffer sizes. Appreciate the advice/thoughts.