Re: Lua Help

Home Forums General Programming Lua Help Re: Lua Help

#2919
atom
Keymaster
  • Topics: 159
  • Replies: 2945
  • Total: 3104
  • ★★★★★

yes i forgot to document the most important method i’m afraid, to change values for a modulator there is a special method setModulatorValue() this is because it’s a bit more compilcated, for example to set some random values to sliders on the panel (from 0-124) use this code
[code:14yn2wyz]
randomSliderColour = function(modulator, newValue)
n = panel:getNumModulators()

for idx = 0, n-1 do

m = panel:getModulatorByIndex(idx)

if m ~= nil then
c = m:getComponent()

if c:getPropertyString("uiType") == "uiSlider" then
m:setModulatorValue (utils.randomInt(124), false, false, true)
end
end

end
end
[/code:14yn2wyz]

this line-> m:setModulatorValue (utils.randomInt(124), false, false, true) means set the random value (max 124), the bool params tell the modulator witch subsystems to notify about the change, this will be in the docs

[code:14yn2wyz]
void setModulatorValue(const int newValue, const bool notifyVstHost=false, const bool notifyMidiDevice=false, const bool notifyComponent=false);
[/code:14yn2wyz]

Ctrlr