You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi again,
thanks to your help, I'm near the completion of my controller.
One last thing I'd love to implement is encoder acceleration (coarse/fine at fast/slow rotation speeds), which would be the icing on the cake. As far as I see, there's no direct implementation for this in your library (I only found long/short press for buttons), but I found your hint on the arduino forum regarding the use of MD_REncoder:
If you're using the Control Surface library, you can plug in your own encoder types into the existing GenericMIDIRotaryEncoder class:
#include<Control_Surface.h>structMyCustomEncoder {
MyCustomEncoder(uint8_t pinA, uint8_t pinB) { /* ... */ }
voidbegin() { /* ... */ } // optionaluint8_tread() { return42; } // preferably returns an unsigned type
};
using MyCustomMIDIEncoder = GenericMIDIRotaryEncoder<MyCustomEncoder, RelativeCCSender>;
MyCustomMIDIEncoder enc {
{2, 3}, // MyCustomEncoder constructor
MIDI_CC::Channel_Volume, // MIDI address1, 4, // Multiplier and pulses per step// ↑ set to 1 if encoder library already handles this
{}, // MIDI sender initialization (unused in this example)
};
USBMIDI_Interface midi;
voidsetup() { Control_Surface.begin(); }
voidloop() { Control_Surface.loop(); }
The idea is that you implement the required functionality in the MyCustomEncoder struct. It should contain a MD_REncoder member variable (or reference/pointer to it), and you should implement the MyCustomEncoder::begin() function to initialize the MD_REncoder. MyCustomEncoder::read() should update and return the position of the encoder (modulo 256).
This seems to be the way to do it, but looking at the few other structures with GenericMIDIRotaryEncoder that I found here, I can't make sense of how to "bake" MD_REncoder into that structure.
If it's not too much to ask, would you give me another hint? Or are there any similar examples that I haven't found yet to have a look at?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi again,
thanks to your help, I'm near the completion of my controller.
One last thing I'd love to implement is encoder acceleration (coarse/fine at fast/slow rotation speeds), which would be the icing on the cake. As far as I see, there's no direct implementation for this in your library (I only found long/short press for buttons), but I found your hint on the arduino forum regarding the use of MD_REncoder:
This seems to be the way to do it, but looking at the few other structures with
GenericMIDIRotaryEncoder
that I found here, I can't make sense of how to "bake" MD_REncoder into that structure.If it's not too much to ask, would you give me another hint? Or are there any similar examples that I haven't found yet to have a look at?
Beta Was this translation helpful? Give feedback.
All reactions