summaryrefslogtreecommitdiff
path: root/quantum/audio.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/audio.h')
-rw-r--r--quantum/audio.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/quantum/audio.h b/quantum/audio.h
index 0fe3eac9af..2d4d303ced 100644
--- a/quantum/audio.h
+++ b/quantum/audio.h
@@ -8,6 +8,11 @@
#ifndef AUDIO_H
#define AUDIO_H
+// Largely untested PWM audio mode (doesn't sound as good)
+// #define PWM_AUDIO
+
+// #define VIBRATO_ENABLE
+
// Enable vibrato strength/amplitude - slows down ISR too much
// #define VIBRATO_STRENGTH_ENABLE
@@ -25,6 +30,8 @@ void audio_off(void);
// Vibrato rate functions
+#ifdef VIBRATO_ENABLE
+
void set_vibrato_rate(float rate);
void increase_vibrato_rate(float change);
void decrease_vibrato_rate(float change);
@@ -37,6 +44,8 @@ void decrease_vibrato_strength(float change);
#endif
+#endif
+
// Polyphony functions
void set_polyphony_rate(float rate);
@@ -51,11 +60,15 @@ void set_tempo(float tempo);
void increase_tempo(uint8_t tempo_change);
void decrease_tempo(uint8_t tempo_change);
+void audio_init();
+
+#ifdef PWM_AUDIO
void play_sample(uint8_t * s, uint16_t l, bool r);
-void play_note(double freq, int vol);
-void stop_note(double freq);
+#endif
+void play_note(float freq, int vol);
+void stop_note(float freq);
void stop_all_notes(void);
-void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest);
+void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest);
#define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
@@ -66,7 +79,7 @@ void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest);
// These macros are used to allow play_notes to play an array of indeterminate
// length. This works around the limitation of C's sizeof operation on pointers.
// The global float array for the song must be used here.
-#define NOTE_ARRAY_SIZE(x) ((int)(sizeof(x) / (sizeof(x[0]))))
+#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
void play_goodbye_tone(void);