I’m new to Lua and I wanted to see if I can get 2 controllers to connect via a script without a direct macro connection, so I did this:
I have a knob connected to a 5 step integer variable named “stepper” to create a stepped instead of smooth knob motion. The script parameter goes out to a text box with @pitchStep in it’s value field.
defineParameter ("pitchStep", Nil, 0, 0, 5, 1, function() pitchStepChange() end) function pitchStepChange() stepChange = stepper end
This worked and the text box reflected the knob value.
Next I tried this:
defineParameter ("pitchStep", Nil, 0, 0, 5, 1, function() pitchStepChange() end) function pitchStepChange() stepChange = stepper this.program:setParameter(22, stepChange) end
parameter ID 22 is program coarse tune.
This didn’t work and I get a script error warning.
I tried this in the Lua midi module and it worked. The coarse tuning was shifted up 5 semitones.
stepChange = 5 this.program:setParameter(22, stepChange)
In my mind if the setParameter function works with a variable in the Lua module it should work in the Macro editor as well. I tried “this.program:setParameter(22, 1)” to remove the variable and still got an error warning.
Any input would be much appreciated.