Sub Layer ModMatrix parameter

Post topics about HALion scripting.
Post Reply
FedericoS
New Member
Posts: 20
Joined: Fri Jan 03, 2020 5:40 pm
Contact:

Sub Layer ModMatrix parameter

Post by FedericoS »

Hello,
I am finding some difficult to detect the right script to reach mod matrix parameter if I have different sub layer. I post an example of my actual script (it does not work) and an image of the tree.
I've solved (thanks to misohoza) in a previous topic the same issue but in a simple (this.parent:getZone():getModulationMatrixRow():setParameter) tree.

Thanks you!
tree.png
(43.84 KiB) Not downloaded yet

Code: Select all

-- set parameter of all zones
function setParameterOfZones(parameterName, value)
	local zones = this.parent:findZones(true)
    for i, zone in pairs(zones) do
		zone:setParameter(parameterName, value)
	end
end

-- reset LFO Rate and Int.1
function onResetDestsLFO1()


newRateLFO1 = 0
newDest1LFO1OSC1 = 0

    setParameterOfZones("LFO 1.Rate", newRateLFO1)

    this.parents:getLayer("Generator 1"):getLayer("OSC"):getZone("OSC Zone"):getModulationMatrixRow(1):setParameter("Destination.Depth", newDest1LFO1OSC1)

end

defineParameter("ResetDestsLFO1", onResetDestsLFO1)

FedericoS
New Member
Posts: 20
Joined: Fri Jan 03, 2020 5:40 pm
Contact:

Re: Sub Layer ModMatrix parameter

Post by FedericoS »

UPDATE
Now it work with the follow script. But I have many zones and many matrix row destinations. It would be great if I can short the script, because with in this way I have to set over 150 script line :shock:

Code: Select all

-- Reset LFO1 Dest

zone1 = this.program:findZones(true)[1]

MRow1 = zone1:getModulationMatrixRow(1)


function onResetLFO1Dest1()


newLFO1Dest1 = 0

    MRow1:setParameter("Destination.Depth", newLFO1Dest1)

end

defineParameter("ResetLFO1Dest1", onResetLFO1Dest1)

misohoza
Member
Posts: 958
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Sub Layer ModMatrix parameter

Post by misohoza »

Hi FedericoS,

You can adapt the setParameterOfZones function to make it work with modulation matrix parameters:

Code: Select all

function setModParameterOfZones(rowNumber, parameterName, value)
  local zones = this.parent:findZones(true)
  for i, zone in ipairs(zones) do
    local modRow = zone:getModulationMatrixRow(rowNumber)
    modRow:setParameter(parameterName, value)
  end
end

setModParameterOfZones(1, "Destination.Depth", 25)
You could also combine the two and use it for both regular zone parameters and modulation matrix parameters:

Code: Select all

-- last argument is optional
-- only used with modulation matrix parameters

function setParameterOfZones(parameterName, value, rowNumber)
  local zones = this.parent:findZones(true)
  for i, zone in ipairs(zones) do
    if rowNumber and type(rowNumber) == "number" then
      local modRow = zone:getModulationMatrixRow(rowNumber)
      modRow:setParameter(parameterName, value)
    else
      zone:setParameter(parameterName, value)
    end
  end
end

setParameterOfZones("ZoneType", 1)
setParameterOfZones("Destination.Depth", 50, 1)
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

FedericoS
New Member
Posts: 20
Joined: Fri Jan 03, 2020 5:40 pm
Contact:

Re: Sub Layer ModMatrix parameter

Post by FedericoS »

misohoza, thanks for your usual precious support and help... (Halion is taking me away from real life :geek: ).
First script is perfect for my need!
Thanks again

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 2 guests