I’ve gotten pretty comfortable linking multiple parameters to one control on the macro page via scripting. However, I’m having a lot of trouble getting this to work with the mod matrix destinations.
I have two rows in the mod matrix that I’d like to be able to control the destinations of using one menu template on the macro page. I’ve customized the list of options for the destinations as well. I’ve inserted most of the mod matrix code I have dealing with destinations below. I’ve commented out just a few of the codes I’ve tried but unfortunately known have yielded any results.
-- define modulation destinations
defineSlotLocal("modDestinations")
modDestinations = {
{ name = "-", index = ModulationDestination.unassigned },
{ name = "Level", index = ModulationDestination.level },
{ name = "Pan", index = ModulationDestination.pan }
{ name = "Cutoff", index = ModulationDestination.cutoff },
{ name = "Resonance", index = ModulationDestination.resonance },
{ name = "Distortion", index = ModulationDestination.distortion },
{ name = "Cutoff Offset", index = ModulationDestination.cutoffOffset },
{ name = "Resonance Offset", index = ModulationDestination.resonanceOffset },
{ name = "Pan", index = ModulationDestination.pan }
}
-- create table with the names of the modulation destinations
function getModDestNames()
modDestNames = {}
for i=1, #modDestinations do
modDestNames[i] = modDestinations[i].name
end
end
getModDestNames()
-- parameter change callback to set the modulation destination
function onModDestChanged(row, modDestinationParam)
local modDestination = modDestinations[modDestinationParam]
local zones = this.parent:getLayer():findZones()
for i, zone in pairs(zones) do
zone:getModulationMatrixRow(row):setParameter("Destination.Destination", modDestination.index)
end
end
mmParameterInfo.strings = modDestNames
-- define parameters for modulation matrix rows
for i = 1, 32 do
mmParameterInfo.name = "ModDestination"..i
mmParameterInfo.longName = "Modulation Destination "..i
mmParameterInfo.onChanged = function() onModDestChanged(i, _G["ModDestination"..i]) end
defineParameter(mmParameterInfo)
end
-- define parameters for arpeggiator controller lane destinations
for i = 1, 3 do
mmParameterInfo.name = "CtrlLane"..i.."Dest"
mmParameterInfo.longName = "Ctrl Lane "..i.." Destination"
mmParameterInfo.onChanged = function() onModDestChanged(16 + i, _G["CtrlLane"..i.."Dest"]) end
defineParameter(mmParameterInfo)
end
function verifyParam(name, callback)
if last[name] ~= _G[name] then
callback()
end
end
--**ATTEMPT TO LINK TWO DESTINATIONS #1**
--[[
function onLinkModDestChanged(row, modDestinationParam)
local modDestination = modDestinations[modDestinationParam]
local zone1Synth=this.parent:getLayer():getZone()
zone1Synth:getModulationMatrixRow(11):getParameter("Destination.Destination", modDestination.index)
zone1Synth:getModulationMatrixRow(25):getParameter("Destination.Destination", modDestination.index)
end
defineParameter("LinkModDestination", "LinkModDestination", onLinkModDestChanged)
]]--
--**ATTEMPT TO LINK TWO DESTINATIONS #2**
--[[
function onLinkModDestChanged(row, modDestinationParam)
local modDestination = modDestinations[modDestinationParam]
local zones = this.parent:getLayer():findZones()
for i, zone in pairs(zones) do
zone:getModulationMatrixRow(11):setParameter("Destination.Destination", modDestination.index)
zone:getModulationMatrixRow(25):setParameter("Destination.Destination", modDestination.index)
end
end
defineParameter("LinkModDestination", "LinkModDestination", onLinkModDestChanged)
]]--
--**ATEMPT TO LINK TWO DESTINATIONS #3**
--[[
function onLinkModDestChanged()
getModDestNames()
function onModDestChanged(11)
function onModDestChanged(25)
mmParameterInfo.strings = modDestNames
end
defineParameter("LinkModDestination", "LinkModDestination", onLinkModDestChanged)
]]--
Any ideas?
Thanks in advance!