Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-29-2023, 02:39 PM   #1
indigomirage
Human being with feelings
 
Join Date: Oct 2020
Posts: 80
Default need some help with param.X.plink.midi_msg and param.X.plink.midi_msg2

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

Last edited by indigomirage; 06-01-2023 at 01:17 PM. Reason: added script reference...
indigomirage is offline   Reply With Quote
Old 10-05-2023, 08:48 AM   #2
Suzuki
Human being with feelings
 
Suzuki's Avatar
 
Join Date: Jul 2022
Location: Japan
Posts: 812
Default

Quote:
Originally Posted by indigomirage View Post
In this example, the Midi Link is Bus 16, Chan 1, 03/35 14 bit.

param.0.plink.midi_msg2 -> 131

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.
Oh, thanks for this. I don't need to experiment to see what midi_msg2 value for 14-bit is thanks to your example
Suzuki is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.