# Playing two sound effects in a queue libgdx

I've been developing this game for which I need to play two sound instances one after another. Calling them one after another results in overlapping sounds. The issue is there is no way to know if a sound has finished playing, any workarounds anyone has found for this?

• If it's always the same 2 sounds, you can combine them offline and play the single sound file, instead of 2. Or you could add a kind of manifest of all the sounds that are in your game which includes their duration, then when you play the second sound, you get the duration of the first, and you artificially add a delay before playing the second sound. P.S. These are generic tips, I'm not familiar with LibGDX. – Vaillancourt Apr 19 '17 at 13:28
• Umm, actually there are a variety of sounds that I need to play, and I'm considering the manifest approach already, thanks for the suggestion. :) – Storm Apr 20 '17 at 16:05

You could load your sound as music and then use the setOnCompletionListener

    Music s1 = Gdx.audio.newMusic(Gdx.files.internal("some1.wav"));
Music s2 = Gdx.audio.newMusic(Gdx.files.internal("some2.wav"));

s1.setOnCompletionListener(new Music.OnCompletionListener() {

@Override
public void onCompletion(Music music) {
s2.play();

}
});

• Ended up using this method; although this is just a workaround, I think libgdx must have a patch for this issue. – Storm May 3 '17 at 5:24