-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsound.js
65 lines (59 loc) · 1.1 KB
/
sound.js
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
const mpg321 = require('mpg321');
const mplayer = mpg321().remote();
const mplayer2 = mpg321().remote();
const mplayer3 = mpg321().remote();
const shoot = 'shoot.mp3';
const menuSong = 'menu.mp3';
const mainSong = 'main.mp3';
const tankS = 'tank.mp3';
const fireSound = () => {
mplayer.play(shoot);
};
const startSound = () => {
mpg321()
.loop(1) // infinity loop
.file('./start.mp3')
.exec();
};
//startSound();
const explosionSound = () => {
mpg321()
.loop(1) // infinity loop
.file('./explosion.mp3')
.exec();
};
const bricksSound = () => {
mpg321()
.loop(1) // infinity loop
.file('./bricks.mp3')
.exec();
};
const deadSound = () => {
mpg321()
.loop(1) // infinity loop
.file('./dead.mp3')
.exec();
};
const tankSound = () => {
mplayer2.play(tankS);
};
const mainMusic = () => {
mplayer3.gain(20);
mplayer3.play(mainSong);
};
const menuMusic = () => {
mplayer.play(menuSong);
};
module.exports = {
fireSound,
startSound,
explosionSound,
bricksSound,
tankSound,
mainMusic,
menuMusic,
mplayer2,
mplayer3,
mplayer,
deadSound
};