Disclaimer: I’m a total noob to Lua (this is my first script) so these might be dumb mistakes on my part. Be gentle
I’m noticing two weird things playing with the MIDI API, hoping someone can shed some light.
First, my input callback function is getting called twice on every incoming message. I haven’t packaged a tool yet, I’m just pressing Execute in the Scripting Editor. Not sure if this would change the behavior, but it seems weird. I set up the input device like so: renoise.Midi.create_input_device(inputDeviceName, callbackFunction). It’s a pretty easy workaround, just ignore every second message - but that doesn’t seem right. My device is a Launchpad - I haven’t tried with any other devices yet, but the Launchpad works properly with other applications (and with Renoise directly, and with Duplex)
Second, to get the output “send” function to work, I have to pass the MidiOutputDevice in as the first argument, like this: midiOut.send(midiOut, message). The documentation says I should be able to do it this way: midiOut.send(message), but Lua gives me an error:
*** No matching overload found, candidates:
*** void send(MidiOutputDevice*,custom [class List<long,class DefaultArrayAllocator >] const&)
I’ve managed to work around both these issues, but clearly I’m missing something. Thanks for any tips!
Edit: Also noticing one other thing - sometimes Renoise will spontaneously release my input device. No error in Lua, just a message in the status bar: Released MIDI-In device: “Launchpad”