-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSound2.java
45 lines (35 loc) · 964 Bytes
/
Sound2.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
42
43
44
import java.io.*;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
public class Sound2 {
public File content;
public Clip klip;
public Sound2(String nom)
throws Exception
{
this.content = new File(nom);
this.klip = AudioSystem.getClip();
}
public void LoadSound()
throws Exception
{
klip.open(AudioSystem.getAudioInputStream(this.content));
}
public void PlaySoundC()
throws Exception
{
klip.open(AudioSystem.getAudioInputStream(this.content));
klip.loop(Clip.LOOP_CONTINUOUSLY);
}
public void Stop()
throws Exception
{
klip.close();
}
public void PlaySound()
throws Exception
{
klip.open(AudioSystem.getAudioInputStream(this.content));
klip.start();
}
}