Align audio keycode names (#18962)

* Align audio keycode names

* Update docs

* Update quantum
master
Joel Challis 2022-11-05 17:05:19 +00:00 committed by GitHub
parent fd4c3f46fb
commit 69fa02c37d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 165 additions and 93 deletions

View File

@ -2,55 +2,64 @@
"keycodes": {
"0x7480": {
"group": "audio",
"key": "AU_ON"
"key": "QK_AUDIO_ON",
"aliases": [
"AU_ON"
]
},
"0x7481": {
"group": "audio",
"key": "AU_OFF"
"key": "QK_AUDIO_OFF",
"aliases": [
"AU_OFF"
]
},
"0x7482": {
"group": "audio",
"key": "AU_TOG"
"key": "QK_AUDIO_TOGGLE",
"aliases": [
"AU_TOGG"
]
},
"0x748A": {
"group": "audio",
"key": "CLICKY_TOGGLE",
"key": "QK_AUDIO_CLICKY_TOGGLE",
"aliases": [
"CK_TOGG"
]
},
"0x748B": {
"group": "audio",
"key": "CLICKY_ENABLE",
"key": "QK_AUDIO_CLICKY_ON",
"aliases": [
"CK_ON"
]
},
"0x748C": {
"group": "audio",
"key": "CLICKY_DISABLE",
"key": "QK_AUDIO_CLICKY_OFF",
"aliases": [
"CK_OFF"
]
},
"0x748D": {
"group": "audio",
"key": "CLICKY_UP",
"key": "QK_AUDIO_CLICKY_UP",
"aliases": [
"CK_UP"
]
},
"0x748E": {
"group": "audio",
"key": "CLICKY_DOWN",
"key": "QK_AUDIO_CLICKY_DOWN",
"aliases": [
"CK_DOWN"
]
},
"0x748F": {
"group": "audio",
"key": "CLICKY_RESET",
"key": "QK_AUDIO_CLICKY_RESET",
"aliases": [
"CK_RST"
]
@ -58,27 +67,46 @@
"0x7490": {
"group": "audio",
"key": "MU_ON"
"key": "QK_MUSIC_ON",
"aliases": [
"MU_ON"
]
},
"0x7491": {
"group": "audio",
"key": "MU_OFF"
"key": "QK_MUSIC_OFF",
"aliases": [
"MU_OFF"
]
},
"0x7492": {
"group": "audio",
"key": "MU_TOG"
"key": "QK_MUSIC_TOGGLE",
"aliases": [
"MU_TOGG"
]
},
"0x7493": {
"group": "audio",
"key": "MU_MOD"
"key": "QK_MUSIC_MODE_NEXT",
"aliases": [
"MU_NEXT"
]
},
"0x7494": {
"group": "audio",
"key": "MUV_IN"
"key": "QK_AUDIO_VOICE_NEXT",
"aliases": [
"AU_NEXT"
]
},
"0x7495": {
"group": "audio",
"key": "MUV_DE"
"key": "QK_AUDIO_VOICE_PREVIOUS",
"aliases": [
"AU_PREV"
]
}
}
}

View File

@ -161,9 +161,11 @@ It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif
The available keycodes for audio are:
* `AU_ON` - Turn Audio Feature on
* `AU_OFF` - Turn Audio Feature off
* `AU_TOG` - Toggle Audio Feature state
|Key |Aliases |Description |
|-------------------------|---------|-------------------------------------------|
|`QK_AUDIO_ON` |`AU_ON` |Turns on Audio Feature |
|`QK_AUDIO_OFF` |`AU_OFF` |Turns off Audio Feature |
|`QK_AUDIO_TOGGLE` |`AU_TOGG`|Toggles Audio state |
!> These keycodes turn all of the audio functionality on and off. Turning it off means that audio feedback, audio clicky, music mode, etc. are disabled, completely.
@ -219,6 +221,12 @@ Aka "audio effects", different ones can be enabled by setting in `config.h` thes
`#define AUDIO_VOICES` to enable the feature, and `#define AUDIO_VOICE_DEFAULT something` to select a specific effect
for details see quantum/audio/voices.h and .c
Keycodes available:
|Key |Aliases |Description |
|-------------------------|---------|-------------------------------------------|
|`QK_AUDIO_VOICE_NEXT` |`AU_NEXT`|Cycles through the audio voices |
|`QK_AUDIO_VOICE_PREVIOUS`|`AU_PREV`|Cycles through the audio voices in reverse |
## Music Mode
@ -228,10 +236,14 @@ Recording is experimental due to some memory issues - if you experience some wei
Keycodes available:
* `MU_ON` - Turn music mode on
* `MU_OFF` - Turn music mode off
* `MU_TOG` - Toggle music mode
* `MU_MOD` - Cycle through the music modes:
|Key |Aliases |Description |
|-------------------------|---------|-------------------------------------------|
|`QK_MUSIC_ON` |`MU_ON` |Turns on Music Mode |
|`QK_MUSIC_OFF` |`MU_OFF` |Turns off Music Mode |
|`QK_MUSIC_TOGGLE` |`MU_TOGG`|Toggles Music Mode |
|`QK_MUSIC_MODE_NEXT` |`MU_NEXT`|Cycles through the music modes |
Available Modes:
* `CHROMATIC_MODE` - Chromatic scale, row changes the octave
* `GUITAR_MODE` - Chromatic scale, but the row changes the string (+5 st)
* `VIOLIN_MODE` - Chromatic scale, but the row changes the string (+7 st)
@ -300,13 +312,16 @@ You can look at the [Planck Keyboard](https://github.com/qmk/qmk_firmware/blob/e
This adds a click sound each time you hit a button, to simulate click sounds from the keyboard. And the sounds are slightly different for each keypress, so it doesn't sound like a single long note, if you type rapidly.
* `CK_TOGG` - Toggles the status (will play sound if enabled)
* `CK_ON` - Turns on Audio Click (plays sound)
* `CK_OFF` - Turns off Audio Click (doesn't play sound)
* `CK_RST` - Resets the frequency to the default state (plays sound at default frequency)
* `CK_UP` - Increases the frequency of the clicks (plays sound at new frequency)
* `CK_DOWN` - Decreases the frequency of the clicks (plays sound at new frequency)
Keycodes available:
|Key |Aliases |Description |
|-------------------------|---------|-------------------------------------------|
|`QK_AUDIO_CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode |
|`QK_AUDIO_CLICKY_ON` |`CK_ON` |Turns on Audio clicky mode |
|`QK_AUDIO_CLICKY_OFF` |`CK_OFF` |Turns on Audio clicky mode |
|`QK_AUDIO_CLICKY_UP` |`CK_UP` |Increases frequency of the clicks |
|`QK_AUDIO_CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks |
|`QK_AUDIO_CLICKY_RESET` |`CK_RST` |Resets frequency to default |
The feature is disabled by default, to save space. To enable it, add this to your `config.h`:
@ -333,16 +348,20 @@ See [MIDI](feature_midi.md)
## Audio Keycodes
|Key |Aliases |Description |
|----------------|---------|----------------------------------|
|`AU_ON` | |Audio mode on |
|`AU_OFF` | |Audio mode off |
|`AU_TOG` | |Toggles Audio mode |
|`CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode |
|`CLICKY_UP` |`CK_UP` |Increases frequency of the clicks |
|`CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks |
|`CLICKY_RESET` |`CK_RST` |Resets frequency to default |
|`MU_ON` | |Turns on Music Mode |
|`MU_OFF` | |Turns off Music Mode |
|`MU_TOG` | |Toggles Music Mode |
|`MU_MOD` | |Cycles through the music modes |
|Key |Aliases |Description |
|-------------------------|---------|-------------------------------------------|
|`QK_AUDIO_ON` |`AU_ON` |Turns on Audio Feature |
|`QK_AUDIO_OFF` |`AU_OFF` |Turns off Audio Feature |
|`QK_AUDIO_TOGGLE` |`AU_TOGG`|Toggles Audio state |
|`QK_AUDIO_CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode |
|`QK_AUDIO_CLICKY_ON` |`CK_ON` |Turns on Audio clicky mode |
|`QK_AUDIO_CLICKY_OFF` |`CK_OFF` |Turns on Audio clicky mode |
|`QK_AUDIO_CLICKY_UP` |`CK_UP` |Increases frequency of the clicks |
|`QK_AUDIO_CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks |
|`QK_AUDIO_CLICKY_RESET` |`CK_RST` |Resets frequency to default |
|`QK_MUSIC_ON` |`MU_ON` |Turns on Music Mode |
|`QK_MUSIC_OFF` |`MU_OFF` |Turns off Music Mode |
|`QK_MUSIC_TOGGLE` |`MU_TOGG`|Toggles Music Mode |
|`QK_MUSIC_MODE_NEXT` |`MU_NEXT`|Cycles through the music modes |
|`QK_AUDIO_VOICE_NEXT` |`AU_NEXT`|Cycles through the audio voices |
|`QK_AUDIO_VOICE_PREVIOUS`|`AU_PREV`|Cycles through the audio voices in reverse |

View File

@ -233,19 +233,23 @@ See also: [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
See also: [Audio](feature_audio.md)
|Key |Aliases |Description |
|----------------|---------|----------------------------------|
|`AU_ON` | |Turns on Audio Feature |
|`AU_OFF` | |Turns off Audio Feature |
|`AU_TOG` | |Toggles Audio state |
|`CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode |
|`CLICKY_UP` |`CK_UP` |Increases frequency of the clicks |
|`CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks |
|`CLICKY_RESET` |`CK_RST` |Resets frequency to default |
|`MU_ON` | |Turns on Music Mode |
|`MU_OFF` | |Turns off Music Mode |
|`MU_TOG` | |Toggles Music Mode |
|`MU_MOD` | |Cycles through the music modes |
|Key |Aliases |Description |
|-------------------------|---------|-------------------------------------------|
|`QK_AUDIO_ON` |`AU_ON` |Turns on Audio Feature |
|`QK_AUDIO_OFF` |`AU_OFF` |Turns off Audio Feature |
|`QK_AUDIO_TOGGLE` |`AU_TOGG`|Toggles Audio state |
|`QK_AUDIO_CLICKY_TOGGLE` |`CK_TOGG`|Toggles Audio clicky mode |
|`QK_AUDIO_CLICKY_ON` |`CK_ON` |Turns on Audio clicky mode |
|`QK_AUDIO_CLICKY_OFF` |`CK_OFF` |Turns on Audio clicky mode |
|`QK_AUDIO_CLICKY_UP` |`CK_UP` |Increases frequency of the clicks |
|`QK_AUDIO_CLICKY_DOWN` |`CK_DOWN`|Decreases frequency of the clicks |
|`QK_AUDIO_CLICKY_RESET` |`CK_RST` |Resets frequency to default |
|`QK_MUSIC_ON` |`MU_ON` |Turns on Music Mode |
|`QK_MUSIC_OFF` |`MU_OFF` |Turns off Music Mode |
|`QK_MUSIC_TOGGLE` |`MU_TOGG`|Toggles Music Mode |
|`QK_MUSIC_MODE_NEXT` |`MU_NEXT`|Cycles through the music modes |
|`QK_AUDIO_VOICE_NEXT` |`AU_NEXT`|Cycles through the audio voices |
|`QK_AUDIO_VOICE_PREVIOUS`|`AU_PREV`|Cycles through the audio voices in reverse |
## Auto Shift :id=auto-shift

View File

@ -563,21 +563,21 @@ enum qk_keycode_defines {
QK_PROGRAMMABLE_BUTTON_30 = 0x745D,
QK_PROGRAMMABLE_BUTTON_31 = 0x745E,
QK_PROGRAMMABLE_BUTTON_32 = 0x745F,
AU_ON = 0x7480,
AU_OFF = 0x7481,
AU_TOG = 0x7482,
CLICKY_TOGGLE = 0x748A,
CLICKY_ENABLE = 0x748B,
CLICKY_DISABLE = 0x748C,
CLICKY_UP = 0x748D,
CLICKY_DOWN = 0x748E,
CLICKY_RESET = 0x748F,
MU_ON = 0x7490,
MU_OFF = 0x7491,
MU_TOG = 0x7492,
MU_MOD = 0x7493,
MUV_IN = 0x7494,
MUV_DE = 0x7495,
QK_AUDIO_ON = 0x7480,
QK_AUDIO_OFF = 0x7481,
QK_AUDIO_TOGGLE = 0x7482,
QK_AUDIO_CLICKY_TOGGLE = 0x748A,
QK_AUDIO_CLICKY_ON = 0x748B,
QK_AUDIO_CLICKY_OFF = 0x748C,
QK_AUDIO_CLICKY_UP = 0x748D,
QK_AUDIO_CLICKY_DOWN = 0x748E,
QK_AUDIO_CLICKY_RESET = 0x748F,
QK_MUSIC_ON = 0x7490,
QK_MUSIC_OFF = 0x7491,
QK_MUSIC_TOGGLE = 0x7492,
QK_MUSIC_MODE_NEXT = 0x7493,
QK_AUDIO_VOICE_NEXT = 0x7494,
QK_AUDIO_VOICE_PREVIOUS = 0x7495,
QK_STENO_BOLT = 0x74F0,
QK_STENO_GEMINI = 0x74F1,
QK_STENO_COMB = 0x74F2,
@ -992,12 +992,21 @@ enum qk_keycode_defines {
PB_30 = QK_PROGRAMMABLE_BUTTON_30,
PB_31 = QK_PROGRAMMABLE_BUTTON_31,
PB_32 = QK_PROGRAMMABLE_BUTTON_32,
CK_TOGG = CLICKY_TOGGLE,
CK_ON = CLICKY_ENABLE,
CK_OFF = CLICKY_DISABLE,
CK_UP = CLICKY_UP,
CK_DOWN = CLICKY_DOWN,
CK_RST = CLICKY_RESET,
AU_ON = QK_AUDIO_ON,
AU_OFF = QK_AUDIO_OFF,
AU_TOGG = QK_AUDIO_TOGGLE,
CK_TOGG = QK_AUDIO_CLICKY_TOGGLE,
CK_ON = QK_AUDIO_CLICKY_ON,
CK_OFF = QK_AUDIO_CLICKY_OFF,
CK_UP = QK_AUDIO_CLICKY_UP,
CK_DOWN = QK_AUDIO_CLICKY_DOWN,
CK_RST = QK_AUDIO_CLICKY_RESET,
MU_ON = QK_MUSIC_ON,
MU_OFF = QK_MUSIC_OFF,
MU_TOGG = QK_MUSIC_TOGGLE,
MU_NEXT = QK_MUSIC_MODE_NEXT,
AU_NEXT = QK_AUDIO_VOICE_NEXT,
AU_PREV = QK_AUDIO_VOICE_PREVIOUS,
MC_0 = QK_MACRO_0,
MC_1 = QK_MACRO_1,
MC_2 = QK_MACRO_2,
@ -1139,7 +1148,7 @@ enum qk_keycode_defines {
#define IS_SEQUENCER_KEYCODE(code) ((code) >= SQ_ON && (code) <= SQ_SCLR)
#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) >= AU_ON && (code) <= MUV_DE)
#define IS_AUDIO_KEYCODE(code) ((code) >= QK_AUDIO_ON && (code) <= QK_AUDIO_VOICE_PREVIOUS)
#define IS_STENO_KEYCODE(code) ((code) >= QK_STENO_BOLT && (code) <= QK_STENO_COMB_MAX)
#define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31)
#define IS_BACKLIGHT_KEYCODE(code) ((code) >= BL_ON && (code) <= BL_BRTG)

View File

@ -16,17 +16,17 @@ float compute_freq_for_midi_note(uint8_t note) {
}
bool process_audio(uint16_t keycode, keyrecord_t *record) {
if (keycode == AU_ON && record->event.pressed) {
if (keycode == QK_AUDIO_ON && record->event.pressed) {
audio_on();
return false;
}
if (keycode == AU_OFF && record->event.pressed) {
if (keycode == QK_AUDIO_OFF && record->event.pressed) {
audio_off();
return false;
}
if (keycode == AU_TOG && record->event.pressed) {
if (keycode == QK_AUDIO_TOGGLE && record->event.pressed) {
if (is_audio_on()) {
audio_off();
} else {
@ -35,13 +35,13 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
return false;
}
if (keycode == MUV_IN && record->event.pressed) {
if (keycode == QK_AUDIO_VOICE_NEXT && record->event.pressed) {
voice_iterate();
PLAY_SONG(voice_change_song);
return false;
}
if (keycode == MUV_DE && record->event.pressed) {
if (keycode == QK_AUDIO_VOICE_PREVIOUS && record->event.pressed) {
voice_deiterate();
PLAY_SONG(voice_change_song);
return false;

View File

@ -82,31 +82,31 @@ bool is_clicky_on(void) {
}
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
if (keycode == CLICKY_TOGGLE && record->event.pressed) {
if (keycode == QK_AUDIO_CLICKY_TOGGLE && record->event.pressed) {
clicky_toggle();
}
if (keycode == CLICKY_ENABLE && record->event.pressed) {
if (keycode == QK_AUDIO_CLICKY_ON && record->event.pressed) {
clicky_on();
}
if (keycode == CLICKY_DISABLE && record->event.pressed) {
if (keycode == QK_AUDIO_CLICKY_OFF && record->event.pressed) {
clicky_off();
}
if (keycode == CLICKY_RESET && record->event.pressed) {
if (keycode == QK_AUDIO_CLICKY_RESET && record->event.pressed) {
clicky_freq_reset();
}
if (keycode == CLICKY_UP && record->event.pressed) {
if (keycode == QK_AUDIO_CLICKY_UP && record->event.pressed) {
clicky_freq_up();
}
if (keycode == CLICKY_DOWN && record->event.pressed) {
if (keycode == QK_AUDIO_CLICKY_DOWN && record->event.pressed) {
clicky_freq_down();
}
if (audio_config.enable && audio_config.clicky_enable) {
if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
if (keycode != AU_OFF && keycode != AU_TOG) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
if (keycode != QK_AUDIO_ON && keycode != QK_AUDIO_OFF) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
clicky_play();
}
}

View File

@ -101,17 +101,17 @@ void music_all_notes_off(void) {
}
bool process_music(uint16_t keycode, keyrecord_t *record) {
if (keycode == MU_ON && record->event.pressed) {
if (keycode == QK_MUSIC_ON && record->event.pressed) {
music_on();
return false;
}
if (keycode == MU_OFF && record->event.pressed) {
if (keycode == QK_MUSIC_OFF && record->event.pressed) {
music_off();
return false;
}
if (keycode == MU_TOG && record->event.pressed) {
if (keycode == QK_MUSIC_TOGGLE && record->event.pressed) {
if (music_activated) {
music_off();
} else {
@ -139,7 +139,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false;
}
if (keycode == MU_MOD && record->event.pressed) {
if (keycode == QK_MUSIC_MODE_NEXT && record->event.pressed) {
music_mode_cycle();
return false;
}

View File

@ -123,6 +123,18 @@
#define KC_RAPC QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE
#define KC_SFTENT QK_SPACE_CADET_RIGHT_SHIFT_ENTER
#define AU_TOG QK_AUDIO_TOGGLE
#define CLICKY_TOGGLE QK_AUDIO_CLICKY_TOGGLE
#define CLICKY_ENABLE QK_AUDIO_CLICKY_ON
#define CLICKY_DISABLE QK_AUDIO_CLICKY_OFF
#define CLICKY_UP QK_AUDIO_CLICKY_UP
#define CLICKY_DOWN QK_AUDIO_CLICKY_DOWN
#define CLICKY_RESET QK_AUDIO_CLICKY_RESET
#define MU_TOG QK_MUSIC_TOGGLE
#define MU_MOD QK_MUSIC_MODE_NEXT
#define MUV_IN QK_AUDIO_VOICE_NEXT
#define MUV_DE QK_AUDIO_VOICE_PREVIOUS
#define TERM_ON _Static_assert(false, "The Terminal feature has been removed from QMK. Please remove use of TERM_ON/TERM_OFF from your keymap.")
#define TERM_OFF _Static_assert(false, "The Terminal feature has been removed from QMK.. Please remove use of TERM_ON/TERM_OFF from your keymap.")
// #define RESET _Static_assert(false, "The RESET keycode has been removed from QMK.. Please remove use from your keymap.")