summaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorJosh <josh@visionistinc.com>2019-05-17 16:48:53 -0400
committerDrashna Jaelre <drashna@live.com>2019-05-17 13:48:53 -0700
commitd85110b6ec5fcdf3ef88b41909ce739b017abbea (patch)
tree4fd8ad2cd4d53362fe9cf1cd6da5fa51b808cc70 /quantum/process_keycode
parent00d1d7828c63538122d9d3db7336b9a40c9ffe80 (diff)
Adds a configurable initial delay to the audio clicky feature (#4286)
* Adding an AUDIO_CLICKY_DELAY_DURATION configurable value to the AUDIO_CLICKY feature. * Tweaking my community keymap to work better with my rev 4 planck.
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_clicky.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/quantum/process_keycode/process_clicky.c b/quantum/process_keycode/process_clicky.c
index 12fef51f9e..43b803afe7 100644
--- a/quantum/process_keycode/process_clicky.c
+++ b/quantum/process_keycode/process_clicky.c
@@ -3,6 +3,9 @@
#ifdef AUDIO_CLICKY
+#ifndef AUDIO_CLICKY_DELAY_DURATION
+#define AUDIO_CLICKY_DELAY_DURATION 1
+#endif // !AUDIO_CLICKY_DELAY_DURATION
#ifndef AUDIO_CLICKY_FREQ_DEFAULT
#define AUDIO_CLICKY_FREQ_DEFAULT 440.0f
#endif // !AUDIO_CLICKY_FREQ_DEFAULT
@@ -21,7 +24,9 @@
float clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
float clicky_rand = AUDIO_CLICKY_FREQ_RANDOMNESS;
-float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
+
+// the first "note" is an intentional delay; the 2nd and 3rd notes are the "clicky"
+float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_MIN, AUDIO_CLICKY_DELAY_DURATION}, {AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
extern audio_config_t audio_config;
@@ -34,8 +39,8 @@ void clicky_play(void) {
#ifndef NO_MUSIC_MODE
if (music_activated || midi_activated || !audio_config.enable) return;
#endif // !NO_MUSIC_MODE
- clicky_song[0][0] = 2.0f * clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
- clicky_song[1][0] = clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
+ clicky_song[1][0] = 2.0f * clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
+ clicky_song[2][0] = clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
PLAY_SONG(clicky_song);
}