View Single Post
Old 09-21-2019, 05:01 AM   #4848
MalcolmG
Human being with feelings
 
MalcolmG's Avatar
 
Join Date: Jun 2015
Location: Sydney, Australia
Posts: 180
Default Using an Encoder as two buttons

Just wanted to share a little victory I had today.

I've been thinking about some additional zones I want to define: one for working in the midi editor, one for working with items in tracks. I have these three encoders across the top of my AlphaTrack that so far I haven't used for much. I had wanted to use them to control the position and the width of the time selection. eg. use the left one to move the left edge of the time selection left when rotated anti-clockwise, right when clockwise. Same for the right encoder with the right edge, and use the middle one to move the whole selection left and right.

There are actions for this, for example, here are the ones for moving the left edge of the time selection left and right:

Code:
 40320 Time selection: Nudge left edge left
 40321 Time selection: Nudge left edge right
However I can't map an action to a decrementing encoder and a different one to an incrementing encoder. Can I?

While mowing the lawn today I realised there might be a way. CSI doesn't know squat about whether it's actually a physical encoder or a fader or a button. It just knows MIDI messages and what I tell it the control is. So I took my widget definition and changed it from this:

Code:
Widget Rotary1 
	Encoder b0 10 7f
WidgetEnd
to this

Code:
Widget RotaryDecrement1 
	Press b0 10 41
WidgetEnd 

Widget RotaryIncrement1 
	Press b0 10 01
WidgetEnd
Those are the actual messages that get sent in the midi monitor. I can then bind them like this in my zone:

Code:
// 40320 Time selection: Nudge left edge left
// 40321 Time selection: Nudge left edge right
    RotaryDecrement1 Reaper 40320 
    RotaryIncrement1 Reaper 40321
and it works like a champ. Very fine-grained control, much better than I get with my mouse. If I can find the right actions, I can see myself doing this for moving track items, midi notes, all sorts of things. Might even use them for moving through the FX in the FX Chain window from my earlier posts.

Just for fun, I decided to see what would happen if I also left the original encoder widget definition in there as well, and at first glance it seems I can have both definitions at once (although I've only tried binding actions to one or the other. Binding at the same time sounds like a recipe for problems).

I had been thinking I needed to put in a request to Geoff to add Increment and Decrement modifiers for encoders, along the lines of the Press modifier for a button, so we can selectively map actions to each direction, but now I don't need to wait.

It was also a good lesson for me to not always think about controls on surfaces and start thinking about messages occasionally.

Tomorrow I need to finish mowing the lawn.
__________________
Filter Theory | CSI Notes wiki

Last edited by MalcolmG; 09-21-2019 at 05:39 AM.
MalcolmG is offline   Reply With Quote