I am using the following code to play a sound file using the java sound API.
Clip clip = AudioSystem.getClip();
AudioInputStream inputStream = AudioS
As of JDK8, Clip
's listener is kind of buggy (i.e. it can happen that it fires the Type.STOP twice for a single reproduction of the audio (.start()
).
I would therefore use something like:
Clip[] myBunchOfClipsToPlaySequentially=new Clip[A_BUNCH];
//
// [load actual clips...]
// [...]
//
for(Clip c: myBunchOfClipsToPlaySequentially)
while(c.getFramePosition()
In addition, you could take a look to the new AudioClip class that JFX8 provides (has some nifty methods to fiddle with)