Davinci Resolve Color Page_CLICK AND DRAG +/- values MIDI translator_Loupedeck+

Hi there,

I’m enjoying MTP and have a handle on the basic functions and program layout. I’m now looking for more advanced support in how to set up rules and local/global variables to execute an on-screen ‘click and drag’ mouse click mapped to a midi input. Specifically, I’d like to adjust values in Davinci Resolve’s Color page. I’m testing the LOG color “Saturation” adjustment from Davinci Resolve in conjunction with the “Saturation” knob from the Loupedeck+ as a proof of concept.

I have been studying the MTP manual chapter 10 “Rules and Variables” for an introductory understanding of what’s possible as well as reviewing this post from Jan 2021 about the same topic for direction on how to begin. From that post, it appears that this project
mouse-click-and-drag-relative-0-0x40-2021-01-15.bmtp (3.6 KB)
Steve created will get me closest to achieving my goal.

I understand I’ll need to set “uu” and “vv” local variables in Rules to identify the monitor relative x/y pixel position assignment for the click-down action, but am lost on how to apply specific parameters to tether the Loupedeck Saturation knob midi signal in place of the existing RAW midi hexidecimal, “B0 00 qq”.

Here are the values captured from the incoming Loupedeck+ midi message capture:

Saturation Knob:
LEFT Channel: 0-Channel 1, (Continious Control) CC# 36, Value 127 (0x7F)
RIGHT Channel: 0-Channel 1, (Continious Control) CC# 36, Value 1 (0x01)

It’s possible I’m asking the wrong question or don’t understand the problem well enough to know what questions to ask. I have limited time to learn MTP so if it’s possible for you to make a comprehensive video tutorial on click/drag MIDI control mapping that would be the most informative for me personally. At any rate, I have no experience with programming so thanks for your help!

Hi, the example I posted had to do with a knob that is a relative encoder that sends 65 or higher for any right movement and 64 or lower for any left movement.

In the below example, it is important that you keep the knob near the center when you start. If your controller can send relative values, it is better but as far as I can see it could not.

I added the global variable za to tell the translators to do nothing if it is recentering.
I use note 0 when pushed to be able to move the knob without doing anything so that you can re-center the pot.

So in summary

translator 0.0 does nothing if you have note 0 pushed

// if we set to recenter, we do nothing
if za==1 then exit rules, skip Outgoing Action

Same with translator 0.1

// recentering
if za==1 then exit rules, skip Outgoing Action

And translator 0.2

// recentering
if za==1 then exit rules, skip Outgoing Action

I also changed calculations for mouse movement in translator 0.1

Old rules:

// This is for relative encoders only
//if qq>64 then rr=64-qq
//if qq<64 then rr=qq

New Rules:

// 2022-02-03 Added this for absolute knobs
// you need to center the knob for this to work properly
// we will use the global variable "zb" as the last known position
// of the encoder
rr=qq-zb
zb=qq

At project start I set the initial value of the knob to center (64) so you should make sure the knob is center when you start the project. (0.4)

zb=64

Translators 0.5 and 0.6 handle setting za to 1 when a button pressed and 0 when released

You still need to set the initial position of the mouse in translator 0.0 based on the
screen location you want the initial click.

// Horizontal location
uu=500
// vertical location
vv=500

And here is the modified project file:

mouse-click-and-drag-absolute-2022-02-03…bmtp (4.7 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Ah. Thanks, you’ve pointed to a piece of information I think I need to begin to understand this process.

I don’t know the type of encoder Loupedeck+ uses, but I assume it’s a Rotary, Incremental (same as Relative?) encoder based on the description available on this page. The knobs on the Loupedeck+ have no “center” as far as I can tell. At least it doesn’t come into play when used as designed with Lightroom and is in no way visible.

What are your thoughts? I assume I need to identify the encoder type before proceeding.

Also, I found the RAW capture incoming setting. They are “MIDI B0 24 01” and “MIDI B0 24 7F” for saturation Right/Left respectively. Is this information relevant?

Thanks for accommodating my basic line of questioning. I’m still working out what I don’t know that I don’t know.

OK, so it appears it is a relative encoder but of a different type of relative that I did originally.

In this cases negative movement -1, -2, -3 is 127, 126, 125 and positive movement is 1, 2, 3.

This makes things much easier and so the rules for the value are now shown below:

// We need to drag the mouse here left or right depending of the value
// qq we save the last value of qq in global variable gb
rr=qq
if qq>64 then rr=128-qq
if qq>64 then rr=rr*-1

Please give it a try.

mouse-click-and-drag-relative-127-1-2022-02-04.bmtp (3.6 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Of course change the incoming CC# from 0 to 0x24 (Decimal 36)

1 Like

This works well. Attached is my revised project file, below are the steps I’m taking to modify the Translator’s parameters and Rules listed chronologically in case it’s helpful to anyone:

  1. Click Down upon Knob
    a. change x/y coordinates in rules (uu, vv)
    b. change incoming RAW midi from CC# 00 to CC#24 (as per saturation dial input). Now “B0 24 qq”
    c. change relative to display 2 on outgoing mouse click (my display is to the right of the main display)

  2. now drag the mouse
    change incoming RAW midi….Now “B0 24 qq”

  3. Set a Click Up timer
    change incoming RAW midi….Now “B0 24 qq”

Thanks for your support, Steve! I don’t know how long this would have taken me to piece together without you.

Is there a post or video that explains best practices for organizing multistep presets like these? By the end I’ll have more than a dozen and I’d love to group them somehow.

mouse-click-and-drag-relative-127-1-2022-02-04_Edited v1.bmtp (3.6 KB)

Hi, no there isn’t a video but here are some guidelines.

  1. Use a different global variable to control the steps of each click and drag action. Increment the variable in every step so that your translators know when to fire (when it is their turn)
  2. Any time you can use local variables. Local variables are pretty disposable and you don’t have to worry as much about name collisions. Of course you need global variables for anything that needs to remain static or change between iterations or needs to be shared with other translatos.
  3. Some times it is good to use a single global variable for a delayed action and then simply increase the delay of it for each step. First step with 0 delay and each step (each translator) adds to the delay, for instance by another 20ms. Then at the end, set it back to 0
  4. Keep your sequences ordered. I usually put translators between them that do nothing but simply have a title or separator so that you can visually see which ones belong together.
  5. This tutorial shows a structure I use for most of my projects (except demo projects) that helps me keep track of my global variables.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

All useful information Thanks!

Question to your #1: In the case of this template, there seems to be only 1 Global variable “ga”.

So I wouldn’t need to change that Global variable between multiples of this preset template in the same project, only use differing Global variables in other translator sequences that include more than 1 Global Variable.

OR

Should I alter this preset template with a different Global Variable in place “ga” with every individual copied instance?

Since you will only be moving one knob at a time and the global variable “ga” indicates when the mouse movement is busy, you can use it for all of your translators. Just don’t try to move more than one knob at a time as the mouse will get quite confused on what it should be doing since each knob will be pointing to a different mouse location.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz