Mouse Question

kbmjkeys88

2016-11-14 16:40:14

Hello,

I'm trying to set up BMT so that I can control Davinci Resolve with a midi controller. In general its working well, but I've run into a few problems and wondering if i'm approaching this the right way.

For the main controls, I make a series of translators that all have the same trigger (a control knob move) to simulate a mouse drag across the control. So the outgoing actions are:

Left mouse down at x,y
mouse move 5
left mouse button up

This works great for some of the controls, but for others, the target software is interpreting those repeated click and drags as a double click, which opens up a text box (instead of dragging for a higher or lower value).

Any ideas how i could solve this problem? Or is there a better way to go about this in general?

florian

2016-11-15 14:38:45

Hi,
this seems to me like a good way. You can slow down MT Pro a bit by specifying a delay for the translator, but I guess in this case you need to prevent too fast executions of all 3 translators.

One way to do this is with a timer: The first time, the translators are triggered, you emulate mouse button down and start a one-shot timer of, say, 250ms. When the timer expires after 250ms, the mouse button up event is sent.
Now the trick is when you trigger the translators again during these 250ms, you don't send mouse button down, but restart the same timer. Now it'll take 250ms again before the timer expires and sends mouse button up. Now you can move the mouse again without clicking the mouse again. In order to know if you've already pressed the mouse button, use a global variable, in this example "g0".

Scheme:
Translator 0: mouse button down
Incoming: (MIDI message)
Rules:
if g0==1 then exit rules, skip outgoing action
g0=1
Outgoing: Left mouse down at x,y

Translator 1: start timer?
Incoming: (MIDI message)
Outgoing: start one-time timer "mouse up", 250ms delay

Translator 2: move mouse
Incoming: (MIDI message)
Outgoing: mouse move 5

Translator 3: mouse button up
Incoming: Timer "mouse up"
Rules:
g0=0
Outgoing: left mouse button up