CCpotentiometer to NRPN based controller #1003
Unanswered
fitzgreyve
asked this question in
Q&A
Replies: 1 comment 5 replies
-
You could use something like this (untested): #include <Control_Surface.h>
class MyCustomPot : public MIDIOutputElement {
public:
MyCustomPot(const Bank<2> &bank, pin_t analogPin, MIDIAddress ccAddr, uint16_t nrpn)
: bank(bank), ccAddr(ccAddr), nrpn(nrpn), filteredAnalog(analogPin) {}
void begin() final override {
filteredAnalog.resetToCurrentValue();
}
void update() final override {
if (filteredAnalog.update())
forcedUpdate();
}
void forcedUpdate() {
switch (bank.getSelection()) {
case 0:
Control_Surface.sendControlChange(ccAddr, filteredAnalog.getValue());
break;
case 1:
Control_Surface.sendControlChange(MIDI_CC::NRPN_LSB, (nrpn >> 0) & 0x7F);
Control_Surface.sendControlChange(MIDI_CC::NRPN_MSB, (nrpn >> 7) & 0x7F);
Control_Surface.sendControlChange(MIDI_CC::Data_Entry_MSB, filteredAnalog.getValue());
break;
default:;
}
}
private:
const Bank<2> &bank;
MIDIAddress ccAddr;
uint16_t nrpn;
AH::FilteredAnalog<7> filteredAnalog;
};
USBMIDI_Interface midi;
Bank<2> bank;
MyCustomPot pot {bank, A0, MIDI_CC::General_Purpose_Controller_1, 0x1234};
IncrementSelector<2> sel {bank, 2};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
} |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Looked for this in the documentation and the issues etc. but could not find anything ?
CCpotentiometer (including bankable and manyaddresses) uses the standard MIDI controllers (CC).
Is there a (simple?) way to define and use NRPN byte sequences instead of the standnrd CC's - i.e. with some potentiometers generating standard CC, some NRPN based.
Ideally with "manyadddresses" a potentiometer could generate a standard CC in one bank, but NRPN based in a different bank ?
Beta Was this translation helpful? Give feedback.
All reactions