mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-01-15 01:48:34 +00:00
Merge pull request #57 from zsa/audio_click_delay
Adds a configurable initial delay to the audio clicky feature (#4286)
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
05-05-2019 - New keycode macro (XP) for shifted character pairs using UNICODEMAP, and bugfixes/improvements
|
||||
05-05-2019 - Add `LINK_TIME_OPTIMIZATION_ENABLE` to enable LTO and disable problematic features that cause LTO to fail
|
||||
05-05-2019 - Fix issue with Space Cadet
|
||||
05-17-2019 - Add configurable delay to Audio Clicky feature
|
||||
05-17-2019 - Make delay for Capslock in Hold-Tap functions configurable
|
||||
05-10-2019 - Split Common i2c Backlight fix
|
||||
05-06-2019 - More readable fix of Mousekeys issue
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user