generated from 32blit/32blit-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAudio.hpp
46 lines (39 loc) · 958 Bytes
/
Audio.hpp
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
#pragma once
#ifdef PICO_BUILD
#include <cmath>
#include "audio/audio.hpp"
#else
#include "audio/mp3-stream.hpp"
#endif // !PICO_BUILD
namespace AudioHandler {
class AudioHandler {
public:
AudioHandler();
void init();
void set_volume(uint32_t = 0xffff);
void set_volume(uint8_t, uint32_t);
void load(uint8_t, const uint8_t[], const uint32_t);
void load(uint8_t, uint8_t);
void play(uint8_t, uint8_t = 0);
bool is_playing(uint8_t);
void update(float dt);
protected:
#ifdef PICO_BUILD
uint8_t tune[24] = {
75, 80, 84, 0, 0, 0, 0, 0,
77, 82, 85, 0, 0, 0, 0, 0,
87, 87, 87, 92, 0, 0, 0, 0,
};
uint8_t note = 0;
bool play_tune = true;
float t = 0.0f;
bool sfx_mute = false;
bool music_mute = false;
#else
blit::MP3Stream mp3_channels[8];
const char* filenames[8] = {
"temp0.mp3", "temp1.mp3", "temp2.mp3", "temp3.mp3", "temp4.mp3", "temp5.mp3", "temp6.mp3", "temp7.mp3"
};
#endif // !PICO_BUILD
};
}