diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-04-21 00:40:00 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-04-21 00:40:00 -0400 |
| commit | e89b806b850ad1b5484176664288b71b0131683e (patch) | |
| tree | bb5f4f2531cfbdafc9cd866b27edfdf96d8e0b59 /quantum/audio | |
| parent | 73228f5e5d1d4cd31a46e5e93aa893a8f727e3b9 (diff) | |
| download | qmk_firmware-e89b806b850ad1b5484176664288b71b0131683e.tar.gz qmk_firmware-e89b806b850ad1b5484176664288b71b0131683e.zip | |
converts tabs to spaces
Diffstat (limited to 'quantum/audio')
| -rw-r--r-- | quantum/audio/voices.c | 88 | ||||
| -rw-r--r-- | quantum/audio/voices.h | 6 |
2 files changed, 47 insertions, 47 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 30e8be641..51652927b 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c | |||
| @@ -6,55 +6,55 @@ extern float note_timbre; | |||
| 6 | voice_type voice = default_voice; | 6 | voice_type voice = default_voice; |
| 7 | 7 | ||
| 8 | void set_voice(voice_type v) { | 8 | void set_voice(voice_type v) { |
| 9 | voice = v; | 9 | voice = v; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | float voice_envelope(float frequency) { | 12 | float voice_envelope(float frequency) { |
| 13 | // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz | 13 | // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz |
| 14 | uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency)); | 14 | uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency)); |
| 15 | 15 | ||
| 16 | switch (voice) { | 16 | switch (voice) { |
| 17 | case default_voice: | 17 | case default_voice: |
| 18 | // nothing here on purpose | 18 | // nothing here on purpose |
| 19 | break; | 19 | break; |
| 20 | case butts_fader: | 20 | case butts_fader: |
| 21 | switch (compensated_index) { | 21 | switch (compensated_index) { |
| 22 | case 0 ... 9: | 22 | case 0 ... 9: |
| 23 | frequency = frequency / 4; | 23 | frequency = frequency / 4; |
| 24 | note_timbre = TIMBRE_12; | 24 | note_timbre = TIMBRE_12; |
| 25 | break; | 25 | break; |
| 26 | case 10 ... 19: | 26 | case 10 ... 19: |
| 27 | frequency = frequency / 2; | 27 | frequency = frequency / 2; |
| 28 | note_timbre = TIMBRE_12; | 28 | note_timbre = TIMBRE_12; |
| 29 | break; | 29 | break; |
| 30 | case 20 ... 200: | 30 | case 20 ... 200: |
| 31 | note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125; | 31 | note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125; |
| 32 | break; | 32 | break; |
| 33 | default: | 33 | default: |
| 34 | note_timbre = 0; | 34 | note_timbre = 0; |
| 35 | break; | 35 | break; |
| 36 | } | 36 | } |
| 37 | break; | 37 | break; |
| 38 | case octave_crunch: | 38 | case octave_crunch: |
| 39 | switch (compensated_index) { | 39 | switch (compensated_index) { |
| 40 | case 0 ... 9: | 40 | case 0 ... 9: |
| 41 | case 20 ... 24: | 41 | case 20 ... 24: |
| 42 | case 30 ... 32: | 42 | case 30 ... 32: |
| 43 | frequency = frequency / 2; | 43 | frequency = frequency / 2; |
| 44 | note_timbre = TIMBRE_12; | 44 | note_timbre = TIMBRE_12; |
| 45 | break; | 45 | break; |
| 46 | case 10 ... 19: | 46 | case 10 ... 19: |
| 47 | case 25 ... 29: | 47 | case 25 ... 29: |
| 48 | case 33 ... 35: | 48 | case 33 ... 35: |
| 49 | frequency = frequency * 2; | 49 | frequency = frequency * 2; |
| 50 | note_timbre = TIMBRE_12; | 50 | note_timbre = TIMBRE_12; |
| 51 | break; | 51 | break; |
| 52 | default: | 52 | default: |
| 53 | note_timbre = TIMBRE_12; | 53 | note_timbre = TIMBRE_12; |
| 54 | break; | 54 | break; |
| 55 | } | 55 | } |
| 56 | break; | 56 | break; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | return frequency; | 59 | return frequency; |
| 60 | } \ No newline at end of file | 60 | } \ No newline at end of file |
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h index 32135dac7..317f5d98c 100644 --- a/quantum/audio/voices.h +++ b/quantum/audio/voices.h | |||
| @@ -11,9 +11,9 @@ | |||
| 11 | float voice_envelope(float frequency); | 11 | float voice_envelope(float frequency); |
| 12 | 12 | ||
| 13 | typedef enum { | 13 | typedef enum { |
| 14 | default_voice, | 14 | default_voice, |
| 15 | butts_fader, | 15 | butts_fader, |
| 16 | octave_crunch | 16 | octave_crunch |
| 17 | } voice_type; | 17 | } voice_type; |
| 18 | 18 | ||
| 19 | void set_voice(voice_type v); | 19 | void set_voice(voice_type v); |
