-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.cpp
37 lines (32 loc) · 981 Bytes
/
play.cpp
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
#include "play.h"
#include <myAudio.h>
// ------------------------------ Audio config ------------------------------
#include "resource/sound_data.h" // 音频数据
const byte *sound_datas[] = { sound_data::cn,
sound_data::en,
sound_data::jp,
sound_data::russian,
sound_data::guandong,
sound_data::sn,
sound_data::shanghai,
sound_data::eg };
#define audioPin 25 // 音频引脚
#define audioNum 8 // 音频文件数量
#define audioDatas sound_datas // 音频数据
// ------------------------------ Audio config ------------------------------
static myAudio my_audio(audioPin, audioNum, audioDatas);
namespace play {
void task(void* pvParameters) {
static RTC_DATA_ATTR byte select = 0;
while(true) {
if( *(bool*)pvParameters ) {
my_audio.play(select);
*(bool*)pvParameters = false;
++select;
}
}
#ifdef DEBUG
Serial.println("sound");
#endif
}
} // namespace play