I tried this…Help please!?
code:
public void playMidiFrom(String path) {
try {
Sequence midi = MidiSystem.getSequence(this.getClass().getClassLoader().getResource(path));
Sequencer player = MidiSystem.getSequencer();
player.open();
player.setSequence(midi);
player.start();
} catch (IOException e) {
System.out.println(“else”);
e.printStackTrace();
} catch (InvalidMidiDataException e) {
System.out.println(“Invalid MIDI data”);
e.printStackTrace();
} catch (MidiUnavailableException e) {
System.out.println(“No midi”);
e.printStackTrace();
}
}
i get this error:
java.lang.IllegalArgumentException: Requested device not installed: null
at javax.sound.midi.MidiSystem.getGenericDevice(MidiSystem.java:1073)
at javax.sound.midi.MidiSystem.getSequencer(MidiSystem.java:277)
at CroAsteroids1.lib.sounds.Sounds.playMidiFrom(Sounds.java:89)
at CroAsteroids1.lib.sounds.Sounds.(Sounds.java:83)
at CroAsteroids1.lib.Asteroids.init(Asteroids.java:283)
at CroAsteroids1.lib.Asteroids.run(Asteroids.java:116)
at CroAsteroids1.lib.Asteroids.main(Asteroids.java:110)
I can play mid’s in Winamp. And i am not trying to play it in winamp at the same time while running the code. Using windows xp.