If you assign a controller using midi CC 50 to the button, the midi message should simply trigger the function, but i don’t see a notifier function attached to your snippet above so hence, nothing will be triggered.
You can also use a different approach and simply read the messages from the Midi device itself through lua. (The device should then not be assigned as input device in the Renoise Midi Preferences though!)
There’s no way to access the CC number that the user has bound to the view. The questions is why you want/need to do so?
MIDI mappings are not just CC’s. They can also be Notes. CCs and Notes have various modes, various settings that are done in the MIDI mapping dialog: relative modes, how to deal with velocity to treat them like booleans and so on.
So you won’t get access to CC numbers, velocity, note values CC values. Instead, Renoise handles the “how to treat the MIDI message” for you, depending on the various options and only passes an abstract “TriggerMessage” object to your callbacks.
If want to trigger an action (like what a button press does), use:
if message:is_trigger() then
-- do something
end
If you want to set something on/off, use:
if message:is_switch() then
some_state = message.boolean_value
end
If you want to change a value, use:
if message:is_rel_value() then
some_value += message.int_value
elseif message:is_abs_value() then
some_value = message.int_value
end
Thanks for the help.
I have already implemented the midimapping with the callback-method.
I wanted to get the assigned CC number because I thaught I need it to reflect the current state of my sequencer (which lights are on/off) to the midi-controller. When the view in the sequencer in renoise changed, I wanted to update the lights on the hardware-controller. I thaught I need the same controller which were assigned via midi mapping to change the state of the light of a button of the controller. But after some investigating, I found out that the most hardware-controller (like the launchpad) have special, own midi messages to control their interface.
So my initial question is obsolete now, but good to know now that it is not possible in a direct way, but I think vv’s approach would work.