~ruther/qmk_firmware

ref: 4aea806aa8aa585930a89b67d7206050ac6adb3a qmk_firmware/quantum/audio.h -rw-r--r-- 509 bytes
4aea806a — IBNobody Adding Musical Notes 9 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include <util/delay.h>

typedef union {
    uint8_t raw;
    struct {
        bool    enable :1;
        uint8_t level  :7;
    };
} audio_config_t;

void audio_toggle(void);
void audio_on(void);
void audio_off(void);

void play_sample(uint8_t * s, uint16_t l, bool r);
void play_note(double freq, int vol);
void stop_note(double freq);
void stop_all_notes();
void init_notes();
void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat);