2019-04-14 12:18:58 +02:00

35 lines
534 B
Java

package mod_audio;
import javax.sound.sampled.Clip;
public class AudioPlayer
implements Runnable {
boolean loop = false;
Clip sound;
public AudioPlayer(Clip clip) {
this.sound = clip;
}
@Override
public void run() {
this.sound.start();
if (this.loop) {
this.sound.loop(-1);
}
}
public boolean isLoop() {
return this.loop;
}
public void setLoop(boolean loop) {
this.loop = loop;
}
}