Original Post
This is my current Sound_Manager Class Now, there are a couple problems with this.
import java.applet.*;
import java.io.*;
public class Sound_Manager extends java.lang.Thread {
private Applet a;
private AudioClip onceClip;
private AudioClip loopClip;
private boolean looping;
public JavaTactics j; //HERE FOR REFERENCES TO LOG
public Sound_Manager(JavaTactics j){
this.j = j;
j.log.add("Created Sound_Manager...");
}
public void play(String playFile){
File file = new File(playFile);
try{
onceClip = a.newAudioClip(file.toURL());
onceClip.play();
}
catch(Exception e){
j.log.add("Error: "+e);
}
}
public void loop(String playFile){
stopLoop();
File file = new File(playFile);
try{
loopClip = a.newAudioClip(file.toURL());
loopClip.loop();
}
catch(Exception e){
j.log.add("Error: "+e);
}
looping = true;
}
public void stopLoop() {
if (looping)
loopClip.stop();
looping = false;
}
}
- No support for mp3/ogg, only midi and wav
- There is significant time to load a file to play
- Not enough control. If I wanted to start the file at 2 minutes 13 seconds etc...