summaryrefslogtreecommitdiff
path: root/quantum/audio/voices.c
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2022-03-25 16:19:22 -0700
committerDrashna Jael're <drashna@live.com>2022-03-25 16:19:22 -0700
commit53ff570bf068e04740f187163774327839dfa68b (patch)
tree5429e069fc593d484b0b479de422b51ac239be83 /quantum/audio/voices.c
parente8171efc7158ba4ebb24827680b19b775d366b1a (diff)
parentefc9c525b19b33c6e09057218ea64f07f45f9555 (diff)
Remerge 0.16.x' into firmware21
Diffstat (limited to 'quantum/audio/voices.c')
-rw-r--r--quantum/audio/voices.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c
index d43fb8d169..4b7d14171f 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -32,10 +32,22 @@ voice_type voice = AUDIO_VOICE_DEFAULT;
voice_type voice = default_voice;
#endif
-void set_voice(voice_type v) { voice = v; }
+void set_voice(voice_type v) {
+ voice = v;
+}
+<<<<<<< HEAD
void voice_iterate() { voice = (voice + 1) % number_of_voices; }
void voice_deiterate() { voice = (voice - 1 + number_of_voices) % number_of_voices; }
+=======
+void voice_iterate() {
+ voice = (voice + 1) % number_of_voices;
+}
+
+void voice_deiterate() {
+ voice = (voice - 1 + number_of_voices) % number_of_voices;
+}
+>>>>>>> qmk/master
#ifdef AUDIO_VOICES
float mod(float a, int b) {
@@ -66,8 +78,8 @@ float voice_envelope(float frequency) {
// envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
// __attribute__((unused)) uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
#ifdef AUDIO_VOICES
- uint16_t envelope_index = timer_elapsed(voices_timer); // TODO: multiply in some factor?
- uint16_t compensated_index = envelope_index / 100; // TODO: correct factor would be?
+ uint16_t envelope_index = timer_elapsed(voices_timer); // TODO: multiply in some factor?
+ uint16_t compensated_index = envelope_index / 100; // TODO: correct factor would be?
#endif
switch (voice) {
@@ -302,7 +314,7 @@ float voice_envelope(float frequency) {
// note_timbre = TIMBRE_25;
// break;
-#endif // AUDIO_VOICES
+#endif // AUDIO_VOICES
default:
break;
@@ -317,19 +329,31 @@ float voice_envelope(float frequency) {
// TODO: where to keep track of the start-frequency?
// frequency = voice_add_glissando(??, frequency);
}
-#endif // AUDIO_VOICES
+#endif // AUDIO_VOICES
return frequency;
}
// Vibrato functions
-void voice_set_vibrato_rate(float rate) { vibrato_rate = rate; }
-void voice_increase_vibrato_rate(float change) { vibrato_rate *= change; }
-void voice_decrease_vibrato_rate(float change) { vibrato_rate /= change; }
-void voice_set_vibrato_strength(float strength) { vibrato_strength = strength; }
-void voice_increase_vibrato_strength(float change) { vibrato_strength *= change; }
-void voice_decrease_vibrato_strength(float change) { vibrato_strength /= change; }
+void voice_set_vibrato_rate(float rate) {
+ vibrato_rate = rate;
+}
+void voice_increase_vibrato_rate(float change) {
+ vibrato_rate *= change;
+}
+void voice_decrease_vibrato_rate(float change) {
+ vibrato_rate /= change;
+}
+void voice_set_vibrato_strength(float strength) {
+ vibrato_strength = strength;
+}
+void voice_increase_vibrato_strength(float change) {
+ vibrato_strength *= change;
+}
+void voice_decrease_vibrato_strength(float change) {
+ vibrato_strength /= change;
+}
// Timbre functions
@@ -338,4 +362,6 @@ void voice_set_timbre(uint8_t timbre) {
note_timbre = timbre;
}
}
-uint8_t voice_get_timbre(void) { return note_timbre; }
+uint8_t voice_get_timbre(void) {
+ return note_timbre;
+}