Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align sequencer keycodes #19875

Merged
merged 2 commits into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions data/constants/keycodes/keycodes_0.0.2_sequencer.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"keycodes": {
"!reset!":0,

"0x7200": {
"group": "sequencer",
"key": "QK_SEQUENCER_ON",
"aliases": [
"SQ_ON"
]
},
"0x7201": {
"group": "sequencer",
"key": "QK_SEQUENCER_OFF",
"aliases": [
"SQ_OFF"
]
},
"0x7202": {
"group": "sequencer",
"key": "QK_SEQUENCER_TOGGLE",
"aliases": [
"SQ_TOGG"
]
},
"0x7203": {
"group": "sequencer",
"key": "QK_SEQUENCER_TEMPO_DOWN",
"aliases": [
"SQ_TMPD"
]
},
"0x7204": {
"group": "sequencer",
"key": "QK_SEQUENCER_TEMPO_UP",
"aliases": [
"SQ_TMPU"
]
},
"0x7205": {
"group": "sequencer",
"key": "QK_SEQUENCER_RESOLUTION_DOWN",
"aliases": [
"SQ_RESD"
]
},
"0x7206": {
"group": "sequencer",
"key": "QK_SEQUENCER_RESOLUTION_UP",
"aliases": [
"SQ_RESU"
]
},
"0x7207": {
"group": "sequencer",
"key": "QK_SEQUENCER_STEPS_ALL",
"aliases": [
"SQ_SALL"
]
},
"0x7208": {
"group": "sequencer",
"key": "QK_SEQUENCER_STEPS_CLEAR",
"aliases": [
"SQ_SCLR"
]
}
}
}
28 changes: 14 additions & 14 deletions docs/feature_sequencer.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ While the tempo defines the absolute speed at which the sequencer goes through t

## Keycodes

|Keycode |Description |
|------- |----------- |
|`SQ_ON` |Start the step sequencer |
|`SQ_OFF` |Stop the step sequencer |
|`SQ_TOG` |Toggle the step sequencer playback |
|`SQ_SALL`|Enable all the steps |
|`SQ_SCLR`|Disable all the steps |
|`SQ_S(n)`|Toggle the step `n` |
|`SQ_TMPD`|Decrease the tempo |
|`SQ_TMPU`|Increase the tempo |
|`SQ_R(n)`|Set the resolution to n |
|`SQ_RESD`|Change to the slower resolution |
|`SQ_RESU`|Change to the faster resolution |
|`SQ_T(n)`|Set `n` as the only active track or deactivate all |
|Key |Aliases |Description |
|-------------------------------|---------|---------------------------------------------------|
|`QK_SEQUENCER_ON` |`SQ_ON` |Start the step sequencer |
|`QK_SEQUENCER_OFF` |`SQ_OFF` |Stop the step sequencer |
|`QK_SEQUENCER_TOGGLE` |`SQ_TOG` |Toggle the step sequencer playback |
|`QK_SEQUENCER_STEPS_ALL` |`SQ_SALL`|Enable all the steps |
|`QK_SEQUENCER_STEPS_CLEAR` |`SQ_SCLR`|Disable all the steps |
|`QK_SEQUENCER_TEMPO_DOWN` |`SQ_TMPD`|Decrease the tempo |
|`QK_SEQUENCER_TEMPO_UP` |`SQ_TMPU`|Increase the tempo |
|`QK_SEQUENCER_RESOLUTION_DOWN` |`SQ_RESD`|Change to the slower resolution |
|`QK_SEQUENCER_RESOLUTION_UP` |`SQ_RESU`|Change to the faster resolution |
|`SQ_S(n)` | |Toggle the step `n` |
|`SQ_R(n)` | |Set the resolution to n |
|`SQ_T(n)` | |Set `n` as the only active track or deactivate all |

## Functions

Expand Down
29 changes: 19 additions & 10 deletions quantum/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,15 @@ enum qk_keycode_defines {
QK_MIDI_MODULATION_SPEED_UP = 0x718D,
QK_MIDI_PITCH_BEND_DOWN = 0x718E,
QK_MIDI_PITCH_BEND_UP = 0x718F,
SQ_ON = 0x7200,
SQ_OFF = 0x7201,
SQ_TOG = 0x7202,
SQ_TMPD = 0x7203,
SQ_TMPU = 0x7204,
SQ_RESD = 0x7205,
SQ_RESU = 0x7206,
SQ_SALL = 0x7207,
SQ_SCLR = 0x7208,
QK_SEQUENCER_ON = 0x7200,
QK_SEQUENCER_OFF = 0x7201,
QK_SEQUENCER_TOGGLE = 0x7202,
QK_SEQUENCER_TEMPO_DOWN = 0x7203,
QK_SEQUENCER_TEMPO_UP = 0x7204,
QK_SEQUENCER_RESOLUTION_DOWN = 0x7205,
QK_SEQUENCER_RESOLUTION_UP = 0x7206,
QK_SEQUENCER_STEPS_ALL = 0x7207,
QK_SEQUENCER_STEPS_CLEAR = 0x7208,
QK_JOYSTICK_BUTTON_0 = 0x7400,
QK_JOYSTICK_BUTTON_1 = 0x7401,
QK_JOYSTICK_BUTTON_2 = 0x7402,
Expand Down Expand Up @@ -1085,6 +1085,15 @@ enum qk_keycode_defines {
MI_MODU = QK_MIDI_MODULATION_SPEED_UP,
MI_BNDD = QK_MIDI_PITCH_BEND_DOWN,
MI_BNDU = QK_MIDI_PITCH_BEND_UP,
SQ_ON = QK_SEQUENCER_ON,
SQ_OFF = QK_SEQUENCER_OFF,
SQ_TOGG = QK_SEQUENCER_TOGGLE,
SQ_TMPD = QK_SEQUENCER_TEMPO_DOWN,
SQ_TMPU = QK_SEQUENCER_TEMPO_UP,
SQ_RESD = QK_SEQUENCER_RESOLUTION_DOWN,
SQ_RESU = QK_SEQUENCER_RESOLUTION_UP,
SQ_SALL = QK_SEQUENCER_STEPS_ALL,
SQ_SCLR = QK_SEQUENCER_STEPS_CLEAR,
JS_0 = QK_JOYSTICK_BUTTON_0,
JS_1 = QK_JOYSTICK_BUTTON_1,
JS_2 = QK_JOYSTICK_BUTTON_2,
Expand Down Expand Up @@ -1329,7 +1338,7 @@ enum qk_keycode_defines {
#define IS_SWAP_HANDS_KEYCODE(code) ((code) >= QK_SWAP_HANDS_TOGGLE && (code) <= QK_SWAP_HANDS_ONE_SHOT)
#define IS_MAGIC_KEYCODE(code) ((code) >= MAGIC_SWAP_CONTROL_CAPSLOCK && (code) <= MAGIC_TOGGLE_ESCAPE_CAPSLOCK)
#define IS_MIDI_KEYCODE(code) ((code) >= QK_MIDI_ON && (code) <= QK_MIDI_PITCH_BEND_UP)
#define IS_SEQUENCER_KEYCODE(code) ((code) >= SQ_ON && (code) <= SQ_SCLR)
#define IS_SEQUENCER_KEYCODE(code) ((code) >= QK_SEQUENCER_ON && (code) <= QK_SEQUENCER_STEPS_CLEAR)
#define IS_JOYSTICK_KEYCODE(code) ((code) >= QK_JOYSTICK_BUTTON_0 && (code) <= QK_JOYSTICK_BUTTON_31)
#define IS_PROGRAMMABLE_BUTTON_KEYCODE(code) ((code) >= QK_PROGRAMMABLE_BUTTON_1 && (code) <= QK_PROGRAMMABLE_BUTTON_32)
#define IS_AUDIO_KEYCODE(code) ((code) >= QK_AUDIO_ON && (code) <= QK_AUDIO_VOICE_PREVIOUS)
Expand Down
24 changes: 12 additions & 12 deletions quantum/process_keycode/process_sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,39 @@
bool process_sequencer(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case SQ_ON:
case QK_SEQUENCER_ON:
sequencer_on();
return false;
case SQ_OFF:
case QK_SEQUENCER_OFF:
sequencer_off();
return false;
case SQ_TOG:
case QK_SEQUENCER_TOGGLE:
sequencer_toggle();
return false;
case SQ_TMPD:
case QK_SEQUENCER_TEMPO_DOWN:
sequencer_decrease_tempo();
return false;
case SQ_TMPU:
case QK_SEQUENCER_TEMPO_UP:
sequencer_increase_tempo();
return false;
case SEQUENCER_RESOLUTION_MIN ... SEQUENCER_RESOLUTION_MAX:
sequencer_set_resolution(keycode - SEQUENCER_RESOLUTION_MIN);
return false;
case SQ_RESD:
case QK_SEQUENCER_RESOLUTION_DOWN:
sequencer_decrease_resolution();
return false;
case SQ_RESU:
case QK_SEQUENCER_RESOLUTION_UP:
sequencer_increase_resolution();
return false;
case SQ_SALL:
case QK_SEQUENCER_STEPS_ALL:
sequencer_set_all_steps_on();
return false;
case SQ_SCLR:
case QK_SEQUENCER_STEPS_CLEAR:
sequencer_set_all_steps_off();
return false;
case SEQUENCER_STEP_MIN ... SEQUENCER_STEP_MAX:
sequencer_toggle_step(keycode - SEQUENCER_STEP_MIN);
return false;
case SEQUENCER_RESOLUTION_MIN ... SEQUENCER_RESOLUTION_MAX:
sequencer_set_resolution(keycode - SEQUENCER_RESOLUTION_MIN);
return false;
case SEQUENCER_TRACK_MIN ... SEQUENCER_TRACK_MAX:
sequencer_toggle_single_active_track(keycode - SEQUENCER_TRACK_MIN);
return false;
Expand Down
18 changes: 9 additions & 9 deletions tests/test_common/keycode_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,15 @@ std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {
{QK_MIDI_MODULATION_SPEED_UP, "QK_MIDI_MODULATION_SPEED_UP"},
{QK_MIDI_PITCH_BEND_DOWN, "QK_MIDI_PITCH_BEND_DOWN"},
{QK_MIDI_PITCH_BEND_UP, "QK_MIDI_PITCH_BEND_UP"},
{SQ_ON, "SQ_ON"},
{SQ_OFF, "SQ_OFF"},
{SQ_TOG, "SQ_TOG"},
{SQ_TMPD, "SQ_TMPD"},
{SQ_TMPU, "SQ_TMPU"},
{SQ_RESD, "SQ_RESD"},
{SQ_RESU, "SQ_RESU"},
{SQ_SALL, "SQ_SALL"},
{SQ_SCLR, "SQ_SCLR"},
{QK_SEQUENCER_ON, "QK_SEQUENCER_ON"},
{QK_SEQUENCER_OFF, "QK_SEQUENCER_OFF"},
{QK_SEQUENCER_TOGGLE, "QK_SEQUENCER_TOGGLE"},
{QK_SEQUENCER_TEMPO_DOWN, "QK_SEQUENCER_TEMPO_DOWN"},
{QK_SEQUENCER_TEMPO_UP, "QK_SEQUENCER_TEMPO_UP"},
{QK_SEQUENCER_RESOLUTION_DOWN, "QK_SEQUENCER_RESOLUTION_DOWN"},
{QK_SEQUENCER_RESOLUTION_UP, "QK_SEQUENCER_RESOLUTION_UP"},
{QK_SEQUENCER_STEPS_ALL, "QK_SEQUENCER_STEPS_ALL"},
{QK_SEQUENCER_STEPS_CLEAR, "QK_SEQUENCER_STEPS_CLEAR"},
{QK_JOYSTICK_BUTTON_0, "QK_JOYSTICK_BUTTON_0"},
{QK_JOYSTICK_BUTTON_1, "QK_JOYSTICK_BUTTON_1"},
{QK_JOYSTICK_BUTTON_2, "QK_JOYSTICK_BUTTON_2"},
Expand Down