I want to change octaves or transpositions when turning the knob on my keyboard. What could I do to get the following code to work?
typedef enum {
ENCODER_MODE_OCTAVE,
ENCODER_MODE_TRANSPOSE,
} encoder_mode_t;
encoder_mode_t encoder_mode = ENCODER_MODE_OCTAVE;
bool encoder_update_user(uint8_t index, bool clockwise) {
if (layer_state_is(MIDI_BASE)) {
if (clockwise) {
if (encoder_mode == ENCODER_MODE_OCTAVE) {
tap_code16(MI_OCTU);
} else {
tap_code16(MI_TRSU);
}
} else {
if (encoder_mode == ENCODER_MODE_OCTAVE) {
tap_code16(MI_OCTD);
} else {
tap_code16(MI_TRSD);
}
}
}
return false;
}
- I receive 'something' when turning the knob, but it's not
MI_OCTx
orMI_TRSx
. - The documentation specifies
tap_code16(<kc>);
so I'm thinking that I can only sendKC_x
keycodes, but I am unsure. - Using
MI_OCTx
orMI_TRSx
in my keymap works. - As a last option, I could implement octave and transposition changes in
process_record_user
by adding or subtracting from the midi note values before usingmidi_send_noteon
, but I am hoping for a 'simpler' solution.