-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwav_player.h
52 lines (42 loc) · 1.02 KB
/
wav_player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef WAV_PLAYER_H
#define WAV_PLAYER_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#define ASR_ATTACK 0
#define ASR_HEAD 1
#define ASR_SUSTAIN 2
#define ASR_RELEASE 3
#define PAUSE_NONE 0
#define PAUSE_START 1
#define PAUSE_PAUSED 2
#define PAUSE_RESUMING 3
struct pan_t {
uint8_t left_vol;
uint8_t right_vol;
};
#define FADE_NORMAL -2
#define FADE_OUT -1
#define FADE_IN_INIT 0
#define FADE_FACTOR_MULTIPLIER 45 // number of 256 sample loops to wait before inc/dec volume by 1
#define FX_NONE ((struct pan_t) {.left_vol = 127, .right_vol = 127})
struct wav_player_event_t {
uint8_t code;
uint8_t voice;
uint8_t channel;
uint8_t note;
uint8_t velocity;
};
void current_bank_up(void);
void current_bank_down(void);
void play_wav(uint8_t voice, uint8_t note, uint8_t velocity);
void toggle_wav(uint8_t voice, uint8_t note, uint8_t velocity);
void stop_wav(uint8_t voice, uint8_t note);
void set_mute(bool should_mute);
#ifdef __cplusplus
}
#endif
#endif