-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSound.cpp
More file actions
43 lines (39 loc) · 1.05 KB
/
Sound.cpp
File metadata and controls
43 lines (39 loc) · 1.05 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
#include "Sound.h"
static int SOUND_ON = 1;
bool isnn = false;
void playSound(int i) {
static vector<const wchar_t*> soundFile{ L"beep.wav", L"move1.wav",
L"AnotherPlay.wav", L"error.wav", L"win.wav", L"draw.wav", L"nhaccho1.wav",L"subload.wav",L"StarPlay.wav" ,L"START.wav",L"confirm.wav",L"load.wav",L"showload.wav",L"show_win.wav",L"versus.wav",L"tick.wav"};
if (isSoundOn == true && SOUND_ON == 1) {
PlaySound(soundFile[i], NULL, SND_FILENAME | SND_ASYNC | SND_NOSTOP);
}
}
void On_Of_sound() {
SOUND_ON++;
if (SOUND_ON > 1) SOUND_ON = 0;
if (SOUND_ON != 1)
{
isSoundOn = false;
PlaySound(0, 0, 0);
}
else if (SOUND_ON == 1) {
isSoundOn = true;
playSound(2);
}
}
void nn() {
if (isnn == true){
isnn = false;
PlaySound(0, 0, 0);
}
else {
isnn = true;
Playnn();
}
}
void Playnn() {
if (isnn) {
// Phát âm thanh nền
PlaySound(L"nhacnen2.wav", NULL, SND_FILENAME | SND_LOOP | SND_ASYNC | SND_NOSTOP);
}
}