Good day, I know very little about programming, I'm doing a project in netbeans in java with a Jframe, where through a list box you select a concept and hear an audio there Everything is fine until I select another audio and the sounds come together distorting completely Is there any way to pause an audio when changing options? I would thank you a lot This is my code
String ruta2 = "G://Proyecto//src//Sonidos e imagenes//Sonidos//Digestivo";
This is the route where the audios are located
private void lstProcesosMousePressed(java.awt.event.MouseEvent evt) {
String Archivo = ruta2 + "//" + lstProcesos.getSelectedValue() + ".wav";
try{
Clip sonido=AudioSystem.getClip();
sonido.open(AudioSystem.getAudioInputStream(new File(Archivo)));
sonido.start();
} catch (Exception e){
System.out.println(""+e);
}
}