Your shopping cart is empty.

Most elegant want to implement inc/dec counter

Submitted by Image_Engine on Mon, 07/20/2020 - 06:39
Image_Engine
Control Surface Studio User

What is the best way to implement an increment/decrement counter that can then be used in scripts? Can extensions be added to controller templates in any way?
eg
Button 1 is target
Ch = 1
CC = 01
Output range 1 to 4
Off value = 0
Behaviour = Wrap (could be ping pong)
RestoreLastState = False (first button press coming back doesnt auto inc ie return from other mode need to remember last state)
Direction = Up (should use arguments order ie 4 to 1 for decrement)

This could be used eg for mode selection etc from a single button. ie cycle modes.
Would be amazing if it could set a global variable too.

Any ideas?

Topic Category: 

2 Responses

Comments

John Carney
Forum Admin
#1

I'm not entirely sure what you're trying to do there, but you can already cycle through modes using a single button.
Add a 'mode selector' mapping to each mode and set it to select the next mode in the loop. Then the last mode/mode selector should select the first mode.
Each mode selector just needs to be mapped to the same button on your controller.

Image_Engine
Control Surface Studio User
#2

Thanks John
So I have buttons starting top left and running down the LHS (smartpad);
Button 1 = Vol/Pan
Button 2 = Sends A - H
and so on.
In firmware, a quick press to button 1 will activate the current mode 1 eg volume. The quick press is simply sending eg B0 01 127. If I double click, the button, it sends the same controller number but this time the cc value is eg 64 and this value will tell remotify that it should now select mode 2 (pan).
Now the user can execute other functions and then may want to come back to activating that button. The quick press is once again send B0 01 127 to activate the current mode. The last mode selected was actually mode 2 in the above example.
Normally in code, I would just assign a global variable and use the double press to increment and wrap a counter value; in this case 0,1,0,1 etc (every time its double pressed). The mode would reference the global and all good.

Button 2 simply has a wide increment range ie A - H = 0>7