Hi.
I am developing a tool to midi map the Launch Control XL (I know it exist Duplex, but my aim is to learn how to do it).
I 've done the complicate thing, but I don’t know why, after creating the midi_callback with : renoise.Midi.create_input_device(device_name, IncomingMidi) I can receive incoming midi but only for a couple of second, then the device close itself (I see it on the Renoise message bar at the bottom of the main window), even no “midi_device_in:close()” instruction is present in my code.
I don’t know if it is the ‘garbage collector’ of lua or Renoise itself, but it my “midi_device_in” object is closed by something… Any Idea to figure out why (the hell) ?
Note that I am new with lua, but not new as a hobbist programmer.
My code:
local function IncomingMidi(message)
assert(#message == 3)
assert(message[1] >= 0 and message[1] <= 0xff)
assert(message[2] >= 0 and message[2] <= 0xff)
assert(message[3] >= 0 and message[3] <= 0xff)if math.floor(message[1]/16) == 0x09 then
print(“Note - Y:”,IncomingNote(message[2])[1]," - X:", IncomingNote(message[2])[2])
midi_device_out:send {message[1], message[2], red_full}
endif math.floor(message[1]/16) == 0x08 then
midi_device_out:send {message[1], message[2], off}
endif math.floor(message[1]/16) == 0x0B then
print(“Pot:”,
IncomingPot(message[2], message[3])[1],
“\nvalue:”,
IncomingPot(message[2], message[3])[2])if IncomingPot(message[2], message[3])[1] ~= 0 then SetValueToParameter(1, 1, IncomingPot(message[2], message[3])) end
end
end
local midi_device_out = renoise.Midi.create_output_device(device_name)
local midi_device_in = renoise.Midi.create_input_device(device_name, IncomingMidi)