summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-09-27 18:12:32 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2018-09-27 18:31:18 -0700
commitedeace279b1cdc5a5450cc5b41d49b341a3a121f (patch)
treee86343dd2b7a68203c800cca691b0f1c6b20ceeb /quantum
parent246d539f295c70846aa4ecaf9cfbe79b959bf3c7 (diff)
Make Audio Clicky's randomness a float
Rather than a define, but read from the define. This way, a smart coder could externally configure the randomness, changing it on the fly This is also a precursor step to adding full on support for configurable randomness.
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_clicky.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/quantum/process_keycode/process_clicky.c b/quantum/process_keycode/process_clicky.c
index 36578047ad..8238c263f9 100644
--- a/quantum/process_keycode/process_clicky.c
+++ b/quantum/process_keycode/process_clicky.c
@@ -20,6 +20,7 @@
#endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
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
extern audio_config_t audio_config;
@@ -33,8 +34,8 @@ void clicky_play(void) {
#ifndef NO_MUSIC_MODE
if (music_activated || midi_activated) return;
#endif // !NO_MUSIC_MODE
- clicky_song[0][0] = 2.0f * clicky_freq * (1.0f + AUDIO_CLICKY_FREQ_RANDOMNESS * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
- clicky_song[1][0] = clicky_freq * (1.0f + AUDIO_CLICKY_FREQ_RANDOMNESS * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
+ 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)) ) );
PLAY_SONG(clicky_song);
}