From 082a0f313d8c842a5de7bae30ec8a3597e35880b Mon Sep 17 00:00:00 2001 From: IBNobody Date: Fri, 22 Apr 2016 00:01:38 -0500 Subject: fixed compiler warnings (#273) --- quantum/audio/audio.h | 6 +++--- quantum/audio/voices.c | 37 +++++++++++++++++++++++++------------ quantum/audio/voices.h | 4 ++-- 3 files changed, 30 insertions(+), 17 deletions(-) (limited to 'quantum/audio') diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h index d1ccfdb82..89769507e 100644 --- a/quantum/audio/audio.h +++ b/quantum/audio/audio.h @@ -50,8 +50,8 @@ void decrease_vibrato_strength(float change); // Polyphony functions void set_polyphony_rate(float rate); -void enable_polyphony(); -void disable_polyphony(); +void enable_polyphony(void); +void disable_polyphony(void); void increase_polyphony_rate(float change); void decrease_polyphony_rate(float change); @@ -61,7 +61,7 @@ void set_tempo(float tempo); void increase_tempo(uint8_t tempo_change); void decrease_tempo(uint8_t tempo_change); -void audio_init(); +void audio_init(void); #ifdef PWM_AUDIO void play_sample(uint8_t * s, uint16_t l, bool r); diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 98631f0cb..330ffb803 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; diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h index 5aa99f4b1..2822fb6ac 100644 --- a/quantum/audio/voices.h +++ b/quantum/audio/voices.h @@ -20,7 +20,7 @@ typedef enum { } voice_type; void set_voice(voice_type v); -void voice_iterate(); -void voice_deiterate(); +void voice_iterate(void); +void voice_deiterate(void); #endif \ No newline at end of file -- cgit v1.2.3-24-g4f1b