diff options
author | skullY <skullydazed@gmail.com> | 2019-08-30 11:19:03 -0700 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-08-30 15:01:52 -0700 |
commit | b624f32f944acdc59dcb130674c09090c5c404cb (patch) | |
tree | bc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /quantum/process_keycode/process_audio.c | |
parent | 61af76a10d00aba185b8338604171de490a13e3b (diff) | |
download | qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip |
clang-format changes
Diffstat (limited to 'quantum/process_keycode/process_audio.c')
-rw-r--r-- | quantum/process_keycode/process_audio.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c index 0a25aa535..3b5fa8490 100644 --- a/quantum/process_keycode/process_audio.c +++ b/quantum/process_keycode/process_audio.c | |||
@@ -2,30 +2,28 @@ | |||
2 | #include "process_audio.h" | 2 | #include "process_audio.h" |
3 | 3 | ||
4 | #ifndef VOICE_CHANGE_SONG | 4 | #ifndef VOICE_CHANGE_SONG |
5 | #define VOICE_CHANGE_SONG SONG(VOICE_CHANGE_SOUND) | 5 | # define VOICE_CHANGE_SONG SONG(VOICE_CHANGE_SOUND) |
6 | #endif | 6 | #endif |
7 | float voice_change_song[][2] = VOICE_CHANGE_SONG; | 7 | float voice_change_song[][2] = VOICE_CHANGE_SONG; |
8 | 8 | ||
9 | #ifndef PITCH_STANDARD_A | 9 | #ifndef PITCH_STANDARD_A |
10 | #define PITCH_STANDARD_A 440.0f | 10 | # define PITCH_STANDARD_A 440.0f |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | float compute_freq_for_midi_note(uint8_t note) | 13 | float compute_freq_for_midi_note(uint8_t note) { |
14 | { | ||
15 | // https://en.wikipedia.org/wiki/MIDI_tuning_standard | 14 | // https://en.wikipedia.org/wiki/MIDI_tuning_standard |
16 | return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A; | 15 | return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A; |
17 | } | 16 | } |
18 | 17 | ||
19 | bool process_audio(uint16_t keycode, keyrecord_t *record) { | 18 | bool process_audio(uint16_t keycode, keyrecord_t *record) { |
20 | |||
21 | if (keycode == AU_ON && record->event.pressed) { | 19 | if (keycode == AU_ON && record->event.pressed) { |
22 | audio_on(); | 20 | audio_on(); |
23 | return false; | 21 | return false; |
24 | } | 22 | } |
25 | 23 | ||
26 | if (keycode == AU_OFF && record->event.pressed) { | 24 | if (keycode == AU_OFF && record->event.pressed) { |
27 | audio_off(); | 25 | audio_off(); |
28 | return false; | 26 | return false; |
29 | } | 27 | } |
30 | 28 | ||
31 | if (keycode == AU_TOG && record->event.pressed) { | 29 | if (keycode == AU_TOG && record->event.pressed) { |
@@ -52,17 +50,10 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) { | |||
52 | return true; | 50 | return true; |
53 | } | 51 | } |
54 | 52 | ||
55 | void process_audio_noteon(uint8_t note) { | 53 | void process_audio_noteon(uint8_t note) { play_note(compute_freq_for_midi_note(note), 0xF); } |
56 | play_note(compute_freq_for_midi_note(note), 0xF); | ||
57 | } | ||
58 | 54 | ||
59 | void process_audio_noteoff(uint8_t note) { | 55 | void process_audio_noteoff(uint8_t note) { stop_note(compute_freq_for_midi_note(note)); } |
60 | stop_note(compute_freq_for_midi_note(note)); | ||
61 | } | ||
62 | 56 | ||
63 | void process_audio_all_notes_off(void) { | 57 | void process_audio_all_notes_off(void) { stop_all_notes(); } |
64 | stop_all_notes(); | ||
65 | } | ||
66 | 58 | ||
67 | __attribute__ ((weak)) | 59 | __attribute__((weak)) void audio_on_user() {} |
68 | void audio_on_user() {} | ||