Hi there - I'm trying to write a script to set a midi link for the the last touched parameter using an input box with multiple fields. (The intent is to set up CC based LFOs or similar and have them modulate fx parameters throughout the project more efficiently - ie, fewer mouse clicks and multiple menu dives, given I want to specify bus and channel, not just cc).
In this example, the Midi Link is Bus 16, Chan 1, 03/35 14 bit.
Parsing parameters from TrackFX_GetNamedConfigParm(), I get...
param.0.plink.active -> 1
param.0.plink.scale -> 1
param.0.plink.offset -> 0
param.0.plink.effect -> -100
param.0.plink.param -> -1
param.0.plink.midi_bus -> 15
param.0.plink.midi_chan -> 1
param.0.plink.midi_msg -> 176
param.0.plink.midi_msg2 -> 131
Presumably, I'll be able to run TrackFX_SetNamedConfigParm() so script in new link parameters, but I'm having trouble understanding how to convert the midi messages from the human-readable values into the midi_msgs required.
If I want 7-bit cc 04, what do I put in midi_msg and midi_msg2 ?
Or, if I want 14-bit cc 04/36, what do I put in midi_msg and midi_msg2 ?
I expect it's just a straightforward bitwise operation, but I'm not sure how to reliably go about it.
If anyone has any handy lua for converting a yes/no (14 vs 7 bit) and a desired cc # (or pair, for 14 bit) into midi_msg and midi_msg2, (and back again) I'd be sincerely grateful.
Many Thanks!
EDIT - After diving in, it seems more straight forward. For CCs, set midi_msg = 176, and midi_msg2 will be the CC#. for 14-bit, midi_msg2 will be the base CC# + 128.
I've put a sample script (which I use) here if it's useful to anyone...
https://stash.reaper.fm/v/46915/MapMidiLinkToParam.lua