ok so I have this sound code I use for all my stuff I need sound in, I used it last about 1 or 2 months ago and it worked, I had it in 2 applications that unfortunatley I don’t have anymore and it worked it played sound and I could make it loop and wahtever I wanted
but now it has stopped working, it doesn’t generate any errors it just doesn’t play the sound, I checked if it is running the code and it is I’ve tried running it in a new application and I tried a new thread in the current application and nothing worked
here’s the code
import java.net.URL;
import javax.sound.midi.*;
public class Music {
public Music() {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
pplay();
}
});t.start();
}
public void pplay() {
// TODO Auto-generated method stub
try {
URL url = new URL("file:c:/theme.mid");
System.out.println("Started");
sequence = MidiSystem.getSequence(url);
sequencer = MidiSystem.getSequencer();
sequencer.open();
sequencer.setSequence(sequence);
sequencer.start();
System.out.println("Done");
} catch(Exception e) {
e.printStackTrace();
}
}
public static Sequence sequence;
public static Sequencer sequencer;
}
I just want to know if I’m missing something, or is there something wrong with my java nothing has changed since I last used this code