I want to create a script for a device with some endless encoders (push encoders) that will move the project cursor and change the zoom level etc. (i.e. things that are not available in the MIDI Remote mapping assistant). I am using an Arduino and I have the Arduino reading the movement of the encoder and sending MIDI CC data. I have a script that is working, but it is not the “elegant” solution. Basically, I have the Arduino send a value of 127 on CC 77 if I turn the encoder clockwise and send a value of 127 on CC 78 if I turn the encoder counter-clockwise. Then, I wrote a script with two buttons, each bound to the two different CCs and they are mapped to the nudge Cursor Left and Right commands.
But, of course, on the MIDI Remote display, I have two buttons instead of a knob (encoder really…) and it seems clunky. It seems to me that a more elegant solution would be to have the Arduino send a value of “0” on a single CC if I turn the encoder CCW and a value of “127” on the same CC if I turn the encoder CW. Then, based on the 0 or 127 value, nudge the cursor left or right.
Or, maybe there is an even better way that is generally the “best practice”. I can write the Arduino code to make it send anything I want it to.
I am picturing using the mOnProcessValueChange() function with an if statement inside that basically says if the value is zero, bind the encoder to the nudge left command and if the value is 127, bind it to the nudge right command. I am going to try this but wondered if someone might offer some help or let me know if I am doing it wrong.
I am somewhat familiar with C++, C#, etc., and “properties” and “methods” but not very familiar with JS or the MIDI Remote API. I have been spending some time and trying to learn. One thing that confuses me is this… Say the value changes and the mOnProcessValueChange function is called. Then, I evaluate the conditions and change the binding accordingly… But I wonder if it is then too late for the host to react the new binding mapping.
Thanks in advance for reading and any help you can provide!