Initial git commit

This commit is contained in:
2019-04-14 12:18:58 +02:00
commit e1c1b51c90
113 changed files with 2646 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
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;
}
}

View File

@@ -0,0 +1,25 @@
package mod_audio;
import basics.BasicMod;
import guis.FileChooseWindow;
public class Gui extends BasicMod {
FileChooseWindow fcw;
public void init() {
}
@Override
public void checkInput(String input) {
}
}

View File

@@ -0,0 +1,46 @@
package mod_audio;
import java.io.File;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import mod_audio.AudioPlayer;
public class Music {
private File audiofile;
private Clip clip;
Thread sound;
private AudioPlayer ap;
public Music(String filename) {
this.audiofile = new File(filename);
try {
this.clip = AudioSystem.getClip();
this.clip.open(AudioSystem.getAudioInputStream(this.audiofile));
}
catch (Exception e) {
e.printStackTrace();
}
this.ap = new AudioPlayer(this.clip);
this.sound = new Thread(this.ap);
}
public void play() {
this.sound.start();
}
public void loop() {
this.ap.setLoop(true);
this.sound.start();
}
public void stop() {
this.clip.close();
}
}