-
Notifications
You must be signed in to change notification settings - Fork 2
/
SoundManager.pde
58 lines (48 loc) · 1.02 KB
/
SoundManager.pde
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
public class SoundManager{
boolean muted = false;
Minim minim;
AudioPlayer dropPiece;
AudioPlayer clearLine;
public void init(){
}
public SoundManager(PApplet applet){
minim = new Minim(applet);
dropPiece = minim.loadFile("audio/dropPiece.wav");
clearLine = minim.loadFile("audio/clearLine.wav");
}
public void setMute(boolean isMuted){
muted = isMuted;
}
public void playDropPieceSound(){
if(muted){
return;
}
dropPiece.play();
dropPiece.rewind();
}
public void playClearLinesSound(){
if(muted){
return;
}
clearLine.play();
clearLine.rewind();
}
/* Should we have 4 different sounds for the number of lines cleared?
*/
public void playSoundByLinesCleared(int linesCleared){
if(muted){
return;
}
playClearLinesSound();
}
public void playClearTetrisSound(){
if(muted){
return;
}
}
public void stop(){
//dropPiece.close();
// minim.stop();
//super.stop();
}
}