I'm trying to play audio clips sequentially, but they all play at the same time. I'm not sure what I am doing wrong. Could you Please help. I'm using JFrame, and this code is giving runtime error.
AudioClip click;
AudioClip click2;
URL urlClick1 = DisplayMath.class.getResource("number11.wav");
click = Applet.newAudioClip(urlClick1);
URL urlClick2 = DisplayMath.class.getResource("number12.wav");
click2 = Applet.newAudioClip(urlClick2);
click.play();
click.notify();
try {
click2.wait();
}
catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
click2.play();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…