diff options
author | Stephan Bösebeck <sb@caluga.de> | 2016-04-20 11:15:59 +0200 |
---|---|---|
committer | Stephan Bösebeck <sb@caluga.de> | 2016-04-20 11:15:59 +0200 |
commit | 13244a259c604ed252331c60a8afc960ae9ebb28 (patch) | |
tree | 01291e3c451928e7af0557b3ecc5ac60dd3c423e /quantum/audio.h | |
parent | f645f9946c11247c19f2347cd25f7ace3a93e9dc (diff) | |
parent | f489ae1ac05dfaf76386bfcde6a89f0d4a0b2cc6 (diff) |
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'quantum/audio.h')
-rw-r--r-- | quantum/audio.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/quantum/audio.h b/quantum/audio.h index 85756af9d4..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,12 +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 init_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), \ @@ -67,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(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style)); void play_goodbye_tone(void); |