summaryrefslogtreecommitdiffstats
path: root/quantum/audio
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-04-21 00:40:00 -0400
committerJack Humbert <jack.humb@gmail.com>2016-04-21 00:40:00 -0400
commite89b806b850ad1b5484176664288b71b0131683e (patch)
treebb5f4f2531cfbdafc9cd866b27edfdf96d8e0b59 /quantum/audio
parent73228f5e5d1d4cd31a46e5e93aa893a8f727e3b9 (diff)
converts tabs to spaces
Diffstat (limited to 'quantum/audio')
-rw-r--r--quantum/audio/voices.c88
-rw-r--r--quantum/audio/voices.h6
2 files changed, 47 insertions, 47 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c
index 30e8be641e..51652927bd 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -6,55 +6,55 @@ extern float note_timbre;
voice_type voice = default_voice;
void set_voice(voice_type v) {
- voice = v;
+ voice = v;
}
float voice_envelope(float frequency) {
- // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
+ // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
switch (voice) {
- case default_voice:
- // nothing here on purpose
- break;
- case butts_fader:
- switch (compensated_index) {
- case 0 ... 9:
- frequency = frequency / 4;
- note_timbre = TIMBRE_12;
- break;
- case 10 ... 19:
- frequency = frequency / 2;
- note_timbre = TIMBRE_12;
- break;
- case 20 ... 200:
- note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
- break;
- default:
- note_timbre = 0;
- break;
- }
- break;
- case octave_crunch:
- switch (compensated_index) {
- case 0 ... 9:
- case 20 ... 24:
- case 30 ... 32:
- frequency = frequency / 2;
- note_timbre = TIMBRE_12;
- break;
- case 10 ... 19:
- case 25 ... 29:
- case 33 ... 35:
- frequency = frequency * 2;
- note_timbre = TIMBRE_12;
- break;
- default:
- note_timbre = TIMBRE_12;
- break;
- }
- break;
- }
+ case default_voice:
+ // nothing here on purpose
+ break;
+ case butts_fader:
+ switch (compensated_index) {
+ case 0 ... 9:
+ frequency = frequency / 4;
+ note_timbre = TIMBRE_12;
+ break;
+ case 10 ... 19:
+ frequency = frequency / 2;
+ note_timbre = TIMBRE_12;
+ break;
+ case 20 ... 200:
+ note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
+ break;
+ default:
+ note_timbre = 0;
+ break;
+ }
+ break;
+ case octave_crunch:
+ switch (compensated_index) {
+ case 0 ... 9:
+ case 20 ... 24:
+ case 30 ... 32:
+ frequency = frequency / 2;
+ note_timbre = TIMBRE_12;
+ break;
+ case 10 ... 19:
+ case 25 ... 29:
+ case 33 ... 35:
+ frequency = frequency * 2;
+ note_timbre = TIMBRE_12;
+ break;
+ default:
+ note_timbre = TIMBRE_12;
+ break;
+ }
+ break;
+ }
- return frequency;
+ return frequency;
} \ No newline at end of file
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h
index 32135dac7f..317f5d98c5 100644
--- a/quantum/audio/voices.h
+++ b/quantum/audio/voices.h
@@ -11,9 +11,9 @@
float voice_envelope(float frequency);
typedef enum {
- default_voice,
- butts_fader,
- octave_crunch
+ default_voice,
+ butts_fader,
+ octave_crunch
} voice_type;
void set_voice(voice_type v);