I tried to replicate what you described.
I made a simple preset with one control that has a Lua function controlCallback()
assigned:
The Lua extension script is like this:
function parameterMap.onChange(valueObjects, origin, midiValue)
print (string.format ("a new midiValue %d from origin %d",
midiValue, origin))
for i, valueObject in ipairs (valueObjects) do
local control = valueObject:getControl ()
print (string.format ("affects control value %s.%s",
control:getName (), valueObject:getId ()))
end
end
function controlCallback(valueObject, value)
local control = valueObject:getControl ()
print (string.format ("callback called control value %s.%s",
control:getName (), valueObject:getId ()))
end
When I twist the knob I get following output in the console:
39980875 lua: callback called control value CUTOFF.value
39980876 lua: a new midiValue 32 from origin 0
39980876 lua: affects control value CUTOFF.value
39980888 sendMessage: port=0, channel=1, type=cc7, parameterNumber=1, midiValue=32
39980955 lua: callback called control value CUTOFF.value
39980957 lua: a new midiValue 31 from origin 0
39980957 lua: affects control value CUTOFF.value
39980966 sendMessage: port=0, channel=1, type=cc7, parameterNumber=1, midiValue=31
ie. both functions (The control’s function controlCallback()
and the parameterMap.onChange()
called and the MIDI message sent out (verified in the MidiMonitor application).
if I comment out the parameterMap.onChange()
like this:
--[[
function parameterMap.onChange(valueObjects, origin, midiValue)
print (string.format ("a new midiValue %d from origin %d",
midiValue, origin))
for i, valueObject in ipairs (valueObjects) do
local control = valueObject:getControl ()
print (string.format ("affects control value %s.%s",
control:getName (), valueObject:getId ()))
end
end
--]]
function controlCallback(valueObject, value)
local control = valueObject:getControl ()
print (string.format ("callback called control value %s.%s",
control:getName (), valueObject:getId ()))
end
Then the callbackFunction()
is called and the MIDI message sent out:
40157752 lua: callback called control value CUTOFF.value
40157752 sendMessage: port=0, channel=1, type=cc7, parameterNumber=1, midiValue=12
40157781 lua: callback called control value CUTOFF.value
40157781 sendMessage: port=0, channel=1, type=cc7, parameterNumber=1, midiValue=13
40157820 lua: callback called control value CUTOFF.value
40157821 sendMessage: port=0, channel=1, type=cc7, parameterNumber=1, midiValue=14
I feel I am doing probably something different than you do. Pls let me know where the difference is. Thanks!