So I’m trying to setup a definedParameter that will be attached to a menu.
Using this code, just as an experiment.
function doIt()
print(envS)
end
defineParameter("envS", nil, 1, {"Amp Env", "Filter Env", "Pitch Env", "User Env"}, doIt)
When attached to a menu the entries are correct, however when selecting an entry
it just returns the index#. How can it be setup so that it returns the actual string?
What I’m trying to do is mod your “Copy/Restore” code so that I can select which envelope type I’m copying/restoring.
defineParameter("CopyEnv", nil, false, function() copyEnvelope("User Env") end)
defineParameter("RestoreEnv", nil, false, function() restoreEnvelope("User Env") end)
defineParameter{name = "DataCopied", default = false, persistent = true, automatable = false, readOnly = true}
zone = this.parent:getZone()
function copyEnvelope(envType)
if CopyEnv then
envelopePoints = zone:getParameter(envType..".EnvelopePoints")
--sustainIndex = zone:getParameter(envType..".SustainIndex")
mode = zone:getParameter(envType..".Mode")
DataCopied = true
wait(50)
CopyEnv = false
end
end
function restoreEnvelope(envType)
if RestoreEnv and DataCopied then
zone:setParameter(envType..".EnvelopePoints", envelopePoints)
--zone:setParameter(envType..".SustainIndex", sustainIndex)
zone:setParameter(envType..".Mode", mode)
wait(50)
RestoreEnv = false
end
end
Another question is, how can I reuse the copy/resetore functions?
I experimented by just duplicating the functions and changing the parameters (envelopePoints & mode) to (envelopePoints2, mode2)…, etc., which works, but I’d rather just reuse if possible so as to make the script more tidy, because I’m probably going to go with around 12 or so.
Thank you,