Page 1 of 1

Sub Layer ModMatrix parameter

Posted: Wed Feb 26, 2020 1:39 pm
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)

Re: Sub Layer ModMatrix parameter

Posted: Wed Feb 26, 2020 7:02 pm
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)

Re: Sub Layer ModMatrix parameter

Posted: Wed Feb 26, 2020 11:40 pm
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)

Re: Sub Layer ModMatrix parameter

Posted: Thu Feb 27, 2020 9:21 am
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