import java.io.*; import javax.sound.sampled.*; static Pair javaSound_playFile(File f) ctex { AudioInputStream stream; AudioFormat format; DataLine.Info info; final new Flag flag; stream = AudioSystem.getAudioInputStream(f); format = stream.getFormat(); info = new DataLine.Info(Clip.class, format); final Clip clip = (Clip) AudioSystem.getLine(info); clip.addLineListener(new LineListener { public void update(LineEvent event) { if (event.getType() == LineEvent.Type.STOP) { clip.close(); flag.raise(); } } }); clip.open(stream); clip.start(); ret pair(clip, flag); }