0

I know, I know -- yet another libgdx "works on desktop, not on android" thread...

I'm having what seems like a strange issue with looping sound effects.

It seems like the Android build of the game I'm working on is only able to loop a single sound effect at any given time.

The Desktop build is able to loop numerous sound effects at the same time, while also playing single-play sound effects alongside the looping ones, and there's no problems. (And again, the looped sounds play concurrently on desktop.)

I have an ongoing looped sound effect for the player's space ship and on Android if that's playing then any other sound.loop() seems to be ignored entirely, though it's able to play single-play sound effects with no problem.

If I change one of the soundEffectAsset.loop() commands to soundEffectAsset.play() it plays fine, just doesn't loop, and if I prevent the player's ship from playing its looped engine sound then other sound effects can be looped, but again only one at a time is able to play.

I've tested this on two different android devices.

I know I've played android games from other developers that have multiple looping sound effects playing simultaneously, so I'm wondering if there's something special one has to do with libgdx in order to get that to work as well on android as it does on desktop.

2

I had the same problem. It seems to be an issue with Sound, reported as bug in 2011 and 2012:

2011 bug report

2012 bug report

Doesn't seem to be fixed anno 2015, but you can work around it by using Music instead of Sound. Haven't found any downside doing this so far.

|improve this answer|||||
  • Thanks, that workaround seems to have this issue sorted out :) – 1337ingDisorder Apr 4 '15 at 0:30
  • How about now? I have a short looping sound where I want to change the pitch according to the gameplay. That cannot be done with Music unfortunately. Using a sound works great on desktop but it only plays once on android. It's just a .mp3 of 56kB. – Madmenyo Jul 16 '16 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.