-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sound.java
41 lines (39 loc) · 845 Bytes
/
Sound.java
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
/* e-LEMON-ators */
import java.applet.*;
public class Sound
{
public static AudioClip getClip(String arg)
{
try {
java.net.URL file = Sound.class.getResource(arg);
return Applet.newAudioClip(file);
} catch (Exception e) {
System.out.println("Error-GetClip");
return null;
}
}
public static void loop(AudioClip arg)
{
try {
arg.loop();
} catch (Exception e) {
System.out.println("Error-Loop");
}
}
public static void play(AudioClip arg)
{
try {
arg.play();
} catch (Exception e) {
System.out.println("Error-Play");
}
}
public static void stop(AudioClip arg)
{
try {
arg.stop();
} catch (Exception e) {
System.out.println("Error-Stop");
}
}
}