sp;map.put(s, s1);
} catch (InvalidMidiDataException ex) {
Logger.getLogger(Test5.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Test5.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (MidiUnavailableException ex) {
Logger.getLogger(Test5.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void createPlayer(String name){
try {
Sequence se=map.get(name);
midi.setSequence(se);
midi.start();
}catch (InvalidMidiDataException ex) {
Logger.getLogger(Test5.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void run(){
while(true){
try {
System.out.println("换文件了."+(++i));
String name=names[(int)(Math.random()*names.length)];
createPlayer(name);
Thread.sleep(10000);