Does anyone know how to get sound effects to overlap themselves? I'm making an audio system right now and I can't for the life of me figure out how to allow a sound effect to play over itself, here's the basic idea: ```java
public class SoundEffect {
private InputStream inputStream;
private AudioInputStream audioStream;
private Clip audioClip;
private DataLine.Info info;
private long clipTime;
private boolean overlapClip;
public SoundEffect(String pathToResource) throws UnsupportedAudioFileException, IOException, LineUnavailableException {
inputStream = getClass().getClassLoader().getResourceAsStream(pathToResource);
audioStream = AudioSystem.getAudioInputStream(inputStream);
AudioFormat format = audioStream.getFormat();
info = new DataLine.Info(Clip.class, format);
audioClip = (Clip) AudioSystem.getLine(info);
audioClip.addLineListener(new SoundClipListener());
audioClip.open(audioStream);
}
public void start() {
if(overlapClip) {
// What can I do to play both clips at once here instead of restarting the currently playing clip?
} else if(!audioClip.isRunning()) {
audioClip.setMicrosecondPosition(0);
audioClip.start();
}
}
}
Also if anyone has a better idea of handling sounds, let me know!