Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Platformer with Leveleditor: Jumping sound disappears on Android

Tagged: ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14083

    Andrej

    Hello!

    I compiled and tested the demo Platformer with Leveleditor and experienced a bug with the jumping sound. After playing a little around the jumping sound disappeared and also didn’t reappear after I quit and rejoined the level. (All other sounds keep working). I experienced this issue on two devices on Android 5.1 and 4.2.

    Here is a log:

    http://pastebin.com/CxDEDe8e

    Line 1197 looks suspicious but I don’t know how to debug this issue. I only added a line in AudioManager to see if the jumping sound is triggered which is true.

    #14087

    Andrej

    The jumping sound reappears after I disabled and reenabled game sounds or after I send the application to the background and bring it to the foreground again.

    #14088

    Günther
    Felgo Team

    Hi Andrej!

    We also experienced similar issues with audio in some projects.  Unfortunately, this bug already comes from the Audio and SoundEffect components by Qt, which we use internally for the BackgroundMusic and SoundEffectVPlay items.

    If and when sounds stop working can depend on various factors like the number of SoundEffect items in the project or the frequency of plays. Sometimes the issue also only occurs for certain devices.

    As described in this thread, we found several workarounds that can help to avoid this problem. For the Platformer with LevelEditor demo, the following steps can help:

    1. Using the QML Audio component instead of SoundEffect. However, this component is not made for fast sound playback, so a delay might occur before the sound plays. Also, I think the audio has to be manually stopped if it is already playing before you can play it again.
    2. The game still uses 14 different SoundEffect items in the AudioManager. It might help to reduce the number by only keeping a pool of e.g. 5 SoundEffect items. When a sound should be played, choose an item that is not used at the moment, set the source audio you want to play and start it.

    Best,
    Günther

    #14089

    Andrej

    Danke Günther! Your explanation sounds insightful. However It seems that on my devices the number of soundeffects is not the issue.

    I tried out the BalloonPop demo and the issue occurs there and is very easy to reproduce when I pop many balloons very fast (means with very short interval between pops). I’m thinking about testing Soundeffects on Qt 5.7 in case this issue is fixed in the new version.

    I found a kind of fix for the balloon demo by using this:

    if(!popSound.playing)
        popSound.play()

    The issue disappeared but this means that there can never be two overlapping popSounds (so overlapping sounds seems the issue here).

    So I created a clone of popSound: popSound2 and now there can be two overlapping sounds and the sound does not disappear. However this solution is a little hacky and is bad if you need more overlapping sounds.

    if(!popSound.playing){
        popSound.play()
     } else {
       if(!popSound2.playing){
           popSound2.play()
       }
     }

    If you have any new suggestions let me now.

    #14090

    Günther
    Felgo Team

    Hi Andrej,

    Thank you for your additional testing and for sharing your solution! It makes sense that overlapping sounds also affect the problem.

    The solution you suggested is actually quite similar to what we did when using a pool of SoundEffects to limit the number of SoundEffect items.
    If a sound is already playing on one item, another SoundEffect item would be used. A pool of 5 items would then mean that 5 sounds can be played overlapping.

    So I think this would be the preferred solution to ensure correct playback across a variety of devices. We don’t think that we will see a fix by Qt anytime soon, as we already reported the problem once and they determined that at least for the way they currently implement audio playback this is something that just happens on some devices.

    Best,
    Günther

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded