I have defined some momentary buttons as virtual. I want specific values to be sent for on and off values, but no matter what I put in there, the button only sends 0 or 1. Is that by design?
To be more precise – I do not know exactly what MIDI values are being sent; likely they are OK. What I am focused on is when a LUA function is called, the (ValueObject, Value) parameters are being passed to it from the button press/release. That Value parameter only show 0 or 1 if I use value like 4 and 15 for the min/max values.
This is by design. It is similar to accessing the “value” of the lists. For pads, you get information about the state of the button (0, 1) as a value. For lists you get an index of the item. The valueObject can be then used to query corresponding MIDI data.
OK, good to know. I’ll modify my code to do as you suggested.
I had assumed I would be able to get the value directly, but it makes sense from a consistency view to have it the way you describe.
Also good to know about the list returning an index as the Value - that could be useful.
@oldgearguy
There is a way to capture other values than just 0/1 by querying the message instead of the valueObject. The function below is called from a momentary pad. The message returns me the ‘On Value’ of the Pad in the variable messageValue. However, it doesn’t do that if you engage the pad by turning its knob instead of pressing the touch screen. I’ve made a bug report for the latter.
function selectIt(ValueObject, value)
if value==0 then return end
local message = ValueObject:getMessage ()
print ("Type: " … message:getType ())
local parameterNumber = message:getParameterNumber ()
print ("Parameter Number: " … parameterNumber)
local messageValue = message:getValue ()
print ("message value: " … messageValue )