diff options
author | IBNobody <IBNobody@users.noreply.github.com> | 2016-04-22 00:01:38 -0500 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-04-22 01:01:38 -0400 |
commit | 082a0f313d8c842a5de7bae30ec8a3597e35880b (patch) | |
tree | 2e53e01fb96aef81a3727ec4ecfbccd6e11cb74b /quantum/audio/voices.c | |
parent | 7b3f212500210ae85063b043952b5b3ef6988ad6 (diff) |
fixed compiler warnings (#273)
Diffstat (limited to 'quantum/audio/voices.c')
-rw-r--r-- | quantum/audio/voices.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 98631f0cb4..330ffb803a 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -1,4 +1,5 @@ #include "voices.h" +#include "stdlib.h" // these are imported from audio.c extern uint16_t envelope_index; @@ -27,26 +28,31 @@ float voice_envelope(float frequency) { case default_voice: note_timbre = TIMBRE_50; polyphony_rate = 0; - break; + break; + case butts_fader: polyphony_rate = 0; switch (compensated_index) { case 0 ... 9: frequency = frequency / 4; note_timbre = TIMBRE_12; - break; + break; + case 10 ... 19: frequency = frequency / 2; note_timbre = TIMBRE_12; - break; + break; + case 20 ... 200: note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125; - break; + break; + default: note_timbre = 0; - break; + break; } - break; + break; + case octave_crunch: polyphony_rate = 0; switch (compensated_index) { @@ -56,17 +62,20 @@ float voice_envelope(float frequency) { 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; + break; + default: note_timbre = TIMBRE_12; - break; + break; } - break; + break; + case duty_osc: // This slows the loop down a substantial amount, so higher notes may freeze polyphony_rate = 0; @@ -78,13 +87,17 @@ float voice_envelope(float frequency) { // note_timbre = (sin((float)compensated_index/10000*OCS_SPEED) * OCS_AMP / 2) + .5; // triangle wave is a bit faster note_timbre = (float)abs((compensated_index*OCS_SPEED % 3000) - 1500) * ( OCS_AMP / 1500 ) + (1 - OCS_AMP) / 2; - break; + break; } - break; + break; + case duty_octave_down: polyphony_rate = 0; note_timbre = (envelope_index % 2) * .125 + .375 * 2; - break; + break; + + default: + break; } return frequency; |