-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsound.h
More file actions
111 lines (102 loc) · 1.64 KB
/
sound.h
File metadata and controls
111 lines (102 loc) · 1.64 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#pragma once
enum SoundID
{
SndWool,
SndStone,
SndWood,
SndBedDestruct,
SndPlayerAttack,
SndBowShoot,
SndBurp,
SndDrink,
SndEat,
SndExplode,
SndGlass,
SndHurt,
SndLevelup,
SndOrb,
SndToast,
SndWater,
SndBell,
SndIcechime,
SndPling,
SndItem,
SndPlop,
SndTeleport,
SndFireball,
SndFuse,
SndEnter,
SndLeave,
SndHit,
SndHitZombie,
SndHitSkeleton,
SndHitSilverfish,
SndHitCreeper,
SndHitVindicator,
SndHitPillager,
SndHitBlaze,
};
const vector<string> sound_names
{
"wool.wav",
"stone.wav",
"wood.wav",
"bed_destruction.wav",
"attack.wav",
"bow.wav",
"burp.wav",
"drink.wav",
"eat.wav",
"explode.wav",
"glass.wav",
"hurt.wav",
"levelup.wav",
"orb.wav",
"toast.wav",
"water.wav",
"bell.wav",
"icechime.wav",
"pling.wav",
"item.wav",
"plop.wav",
"teleport.wav",
"fireball.wav",
"fuse.wav",
"door_open.wav",
"door_close.wav",
"hit.wav",
"hit_zombie.wav",
"hit_skeleton.wav",
"hit_silverfish.wav",
"hit_creeper.wav",
"hit_vindicator.wav",
"hit_pillager.wav",
"hit_blaze.wav",
};
void SoundRaw(SoundID sid)
{
sndPlaySound((g.audio_dir + sound_names.at(sid)).c_str(),
SND_ASYNC | SND_FILENAME);
}
void Sound(SoundID sid)
{ //¿ª¶ÀÁ¢Ïß³Ì
thread thr([](string sname)
{
/*sndPlaySound((g.audio_dir + sname).c_str(),
SND_SYNC | SND_FILENAME);*/
CPlayer cp;
if (!cp.Open((g.audio_dir + sname).c_str()))
{
//MessageBox(nullptr, sname.c_str(), "md", 0);
MessageBeep(MB_ICONERROR);
return;
}
DWORD dwLen = cp.GetLength();
cp.Play(); //async
api_sleep(dwLen);
cp.Stop();
cp.Close();
},
sound_names.at(sid));
thr.detach();
}