-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudio.cpp
More file actions
89 lines (75 loc) · 1.57 KB
/
Copy pathaudio.cpp
File metadata and controls
89 lines (75 loc) · 1.57 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "audio.h"
#include <M5Unified.h>
void audioInit() {
M5.Speaker.setVolume(SPEAKER_VOLUME);
}
void audioLifeUp() {
M5.Speaker.tone(TONE_LIFE_UP, TONE_DURATION);
}
void audioLifeDown() {
M5.Speaker.tone(TONE_LIFE_DOWN, TONE_DURATION);
}
void audioDiceRoll() {
for (int i = 0; i < 5; i++) {
M5.Speaker.tone(800 + i * 100, 40);
delay(50);
}
M5.Speaker.tone(TONE_DICE_ROLL, 150);
}
void audioCoinFlip() {
M5.Speaker.tone(TONE_COIN_FLIP, 60);
delay(80);
M5.Speaker.tone(TONE_COIN_FLIP + 200, 60);
delay(80);
M5.Speaker.tone(TONE_COIN_FLIP + 400, 100);
}
void audioConfirm() {
M5.Speaker.tone(TONE_CONFIRM, 100);
}
void audioDefeat() {
M5.Speaker.tone(440, 200);
delay(220);
M5.Speaker.tone(370, 200);
delay(220);
M5.Speaker.tone(330, 200);
delay(220);
M5.Speaker.tone(TONE_DEFEAT, 400);
}
void audioStartup() {
M5.Speaker.tone(523, 80);
delay(100);
M5.Speaker.tone(659, 80);
delay(100);
M5.Speaker.tone(784, 80);
delay(100);
M5.Speaker.tone(1047, 150);
}
void audioVictory() {
M5.Speaker.tone(523, 120);
delay(140);
M5.Speaker.tone(659, 120);
delay(140);
M5.Speaker.tone(784, 120);
delay(140);
M5.Speaker.tone(1047, 300);
delay(320);
M5.Speaker.tone(1047, 200);
}
void audioGamePoint() {
M5.Speaker.tone(1318, 50);
}
void audioGameHit() {
M5.Speaker.tone(200, 100);
}
void audioGameOver() {
M5.Speaker.tone(392, 150);
delay(170);
M5.Speaker.tone(330, 150);
delay(170);
M5.Speaker.tone(262, 300);
}
void audioGameAttack() {
M5.Speaker.tone(1500, 40);
delay(50);
M5.Speaker.tone(1800, 40);
}