aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/feature_audio.md12
-rw-r--r--quantum/process_keycode/process_clicky.c11
-rw-r--r--quantum/process_keycode/process_clicky.h7
-rw-r--r--quantum/quantum_keycodes.h5
4 files changed, 23 insertions, 12 deletions
diff --git a/docs/feature_audio.md b/docs/feature_audio.md
index fe210c09b..82e0ed950 100644
--- a/docs/feature_audio.md
+++ b/docs/feature_audio.md
@@ -119,14 +119,16 @@ You can completely disable Music Mode as well. This is useful, if you're pressed
119 119
120 #define NO_MUSIC_MODE 120 #define NO_MUSIC_MODE
121 121
122## Faux Click 122## Audio Click
123 123
124This 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. 124This 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.
125 125
126* `CK_TOGG` - Toggles the status (will play sound if enabled) 126* `CK_TOGG` - Toggles the status (will play sound if enabled)
127* `CK_RST` - Resets the frequency to the default state 127* `CK_ON` - Turns on Audio Click (plays sound)
128* `CK_UP` - Increases the frequency of the clicks 128* `CK_OFF` - Turns off Audio Click (doesn't play sound)
129* `CK_DOWN` - Decreases the frequency of the clicks 129* `CK_RST` - Resets the frequency to the default state (plays sound at default frequency)
130* `CK_UP` - Increases the frequency of the clicks (plays sound at new frequency)
131* `CK_DOWN` - Decreases the frequency of the clicks (plays sound at new frequency)
130 132
131 133
132The feature is disabled by default, to save space. To enable it, add this to your `config.h`: 134The feature is disabled by default, to save space. To enable it, add this to your `config.h`:
@@ -142,7 +144,7 @@ You can configure the default, min and max frequencies, the stepping and built i
142| `AUDIO_CLICKY_FREQ_MIN` | 65.0f | Sets the lowest frequency (under 60f are a bit buggy). | 144| `AUDIO_CLICKY_FREQ_MIN` | 65.0f | Sets the lowest frequency (under 60f are a bit buggy). |
143| `AUDIO_CLICKY_FREQ_MAX` | 1500.0f | Sets the the highest frequency. Too high may result in coworkers attacking you. | 145| `AUDIO_CLICKY_FREQ_MAX` | 1500.0f | Sets the the highest frequency. Too high may result in coworkers attacking you. |
144| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. | 146| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. |
145| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical. | 147| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical, and `1.0f` will make this sound much like the 90's computer screen scrolling/typing effect. |
146 148
147 149
148 150
diff --git a/quantum/process_keycode/process_clicky.c b/quantum/process_keycode/process_clicky.c
index b3c8d890e..36578047a 100644
--- a/quantum/process_keycode/process_clicky.c
+++ b/quantum/process_keycode/process_clicky.c
@@ -56,17 +56,17 @@ void clicky_freq_reset(void) {
56 clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; 56 clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
57} 57}
58 58
59void clicky_freq_toggle(void) { 59void clicky_toggle(void) {
60 audio_config.clicky_enable ^= 1; 60 audio_config.clicky_enable ^= 1;
61 eeconfig_update_audio(audio_config.raw); 61 eeconfig_update_audio(audio_config.raw);
62} 62}
63 63
64void clicky_freq_on(void) { 64void clicky_on(void) {
65 audio_config.clicky_enable = 1; 65 audio_config.clicky_enable = 1;
66 eeconfig_update_audio(audio_config.raw); 66 eeconfig_update_audio(audio_config.raw);
67} 67}
68 68
69void clicky_freq_off(void) { 69void clicky_off(void) {
70 audio_config.clicky_enable = 0; 70 audio_config.clicky_enable = 0;
71 eeconfig_update_audio(audio_config.raw); 71 eeconfig_update_audio(audio_config.raw);
72} 72}
@@ -76,7 +76,10 @@ bool is_clicky_on(void) {
76} 76}
77 77
78bool process_clicky(uint16_t keycode, keyrecord_t *record) { 78bool process_clicky(uint16_t keycode, keyrecord_t *record) {
79 if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_freq_toggle(); } 79 if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_toggle(); }
80
81 if (keycode == CLICKY_ENABLE && record->event.pressed) { clicky_on(); }
82 if (keycode == CLICKY_DISABLE && record->event.pressed) { clicky_off(); }
80 83
81 if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq_reset(); } 84 if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq_reset(); }
82 85
diff --git a/quantum/process_keycode/process_clicky.h b/quantum/process_keycode/process_clicky.h
index 6ee3cc5d9..f746edb95 100644
--- a/quantum/process_keycode/process_clicky.h
+++ b/quantum/process_keycode/process_clicky.h
@@ -7,9 +7,10 @@ bool process_clicky(uint16_t keycode, keyrecord_t *record);
7void clicky_freq_up(void); 7void clicky_freq_up(void);
8void clicky_freq_down(void); 8void clicky_freq_down(void);
9void clicky_freq_reset(void); 9void clicky_freq_reset(void);
10void clicky_freq_toggle(void); 10
11void clicky_freq_on(void); 11void clicky_toggle(void);
12void clicky_freq_off(void); 12void clicky_on(void);
13void clicky_off(void);
13 14
14bool is_clicky_on(void); 15bool is_clicky_on(void);
15 16
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 050d2d275..e983798f2 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -139,10 +139,13 @@ enum quantum_keycodes {
139 139
140 // Faux clicky as part of main audio feature 140 // Faux clicky as part of main audio feature
141 CLICKY_TOGGLE, 141 CLICKY_TOGGLE,
142 CLICKY_ENABLE,
143 CLICKY_DISABLE,
142 CLICKY_UP, 144 CLICKY_UP,
143 CLICKY_DOWN, 145 CLICKY_DOWN,
144 CLICKY_RESET, 146 CLICKY_RESET,
145 147
148
146#ifdef FAUXCLICKY_ENABLE 149#ifdef FAUXCLICKY_ENABLE
147 // Faux clicky 150 // Faux clicky
148 FC_ON, 151 FC_ON,
@@ -571,6 +574,8 @@ enum quantum_keycodes {
571#define CK_RST CLICKY_RESET 574#define CK_RST CLICKY_RESET
572#define CK_UP CLICKY_UP 575#define CK_UP CLICKY_UP
573#define CK_DOWN CLICKY_DOWN 576#define CK_DOWN CLICKY_DOWN
577#define CK_ON CLICKY_ENABLE
578#define CK_OFF CLICKY_DISABLE
574 579
575#define RGB_MOD RGB_MODE_FORWARD 580#define RGB_MOD RGB_MODE_FORWARD
576#define RGB_SMOD RGB_MODE_FORWARD 581#define RGB_SMOD RGB_MODE_FORWARD