Page 1 of 1

Parameter Jumping with standard MIDI controls

Posted: Wed Oct 12, 2011 2:56 pm
by Lutz
This problem pops up once in a while, when using standard MIDI controls:
You edit any parameter in M8 (happens with other apps as well), and when you change layers and touch that specific
control again, the parameter of that newly selected layer will jump to the value that the control is sending.
Not nice.
A possible solution would be some sort of 'grab-mode', where you move the control until you hit the value that is actually
in M8. At this point that value gets 'grabbed' and now the new value is written to M8.
Here's how it works:
Let's assume we want to control the RED-Level of a layer with MIDI controler zero.
Make shure these two are NOT mapped with the M8-MIDI-Mapping!
Here's your init-script:

Init()

Code: Select all

grabR = 0


And here's your direct-event-script:

DirectEvent()

Code: Select all

if type == 'MIDI' and param['channel'] == 1 and param['message'] == 'CONTROL_CHANGE' and param['param1'] == 0:
   arg1 = round(modul8.getValue('ctrl_layer_color_modulateR',0),2)
   arg2 = round(param['param2']/127.0, 2)
   if arg1 == arg2:
      grabR = 1
   elif abs(arg1-arg2) > 0.1:
      grabR = 0
      
   if grabR == 1 :
      modul8.setValue ('ctrl_layer_color_modulateR',arg2,0)


Works when changing layers or clicking with the mouse.
Let me know if it works for you, it does here.
Lutz

p.s.: Sorry for re-inventing the wheel if that's been posted before.