Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / [Bug] PlaySound causes game to freeze for an instant

Author
Message
gibs
4
Years of Service
User Offline
Joined: 26th Feb 2016
Location:
Posted: 21st May 2020 19:49 Edited at: 22nd May 2020 08:11
For unknown reason, I can't answer this (old?) thread:

https://forum.thegamecreators.com/thread/219938#postHolder
I also found the same issue here : https://forum.thegamecreators.com/thread/213601

I am also experiencing slowdown during the PlaySound command.

My actual Android phone is an Oppo Find X.
The slowdowns are also present on my Sony Xperia F5121.

Like the guy in the previous thread above, it's not about the code, but it's really the Playsound command with some devices.

There are no slowdown with the same code on my Samsung Galaxy S6 (which is quite older).

I sure of that. I took an old code from 2016, at that time I wasn't experiencing slowdowns, and I had the Samsung Galaxy S6.
With the latest AppGameKit Classic or AppGameKit Studio version, I don't have any slowdown with the Samsung GS6.
When I execute the code on the Oppo Find X (Android 10) or the Sony Xperia F5121 (Android 8) , I get slowdown during the playsound command.

Of course if I remove the Playsound command from the code, I don't have any slowdown anymore (but that's not what I want)

I hope somebody will bring a solution. I don't like the idea of a game running slower on newer devices.

Thanks
gibs
4
Years of Service
User Offline
Joined: 26th Feb 2016
Location:
Posted: 22nd May 2020 13:07 Edited at: 23rd May 2020 07:28
Here is a video showing (from top to bottom) :

Oppo Find X (Android 10)
Sony Xperia (Android 8)
Samsung Galaxy S6 (Android 7)

https://www.youtube.com/watch?v=LMvGjNoRj24

Note that :

1/ The problem is also present on the Nokia 8 Sirocco
2/ The problem is also present when I play the game "2015m" which is a game done by a member of this forum.

Any Appgamekit developper around ?
Virtual Nomad
Moderator
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd May 2020 05:45 Edited at: 23rd May 2020 05:46
gibs,

since they're relatively short sounds that you're playing, i thought of this recent thread even tho the issue may not be related.

but, if you play/loop sounds > 0.5 secs in duration, do you experience the same?

otherwise, threads automatically get locked if inactive for 90+ days (from the bottom of that thread):
Quote: "Thread locked

This thread has not been posted in for more than 90 days and has been locked!"
gibs
4
Years of Service
User Offline
Joined: 26th Feb 2016
Location:
Posted: 23rd May 2020 07:25 Edited at: 23rd May 2020 07:41
Hi Virtual Nomad,

Thanks for your answer.
The sound I'm playing in the video is not looping and it is > 0.5 sec (exactly 0.628 sec)

I made it 1 second length (by adding some silent at the end with audacity) and the result is the same.
It's a 16bit 44KHz mono wav.

The code is (just to prove the touch screen is not in cause) :



As you have seen I have 4 Android phones (Oppo Find X, Sony Xperia X, Nokia 8 Sirocco, Samsung Galaxy S6 )and 3 of them are affected.
I have also tried on iPhone 5s : no problems at all.

I have already said that but when I play AppGameKit games downloaded from the playstore, I have the exact same problem.

Example with this game : https://forum.thegamecreators.com/thread/213455

The intro with the music is perfectly smooth , and when you play and touch the screen to jump, there is a playsound() command that stop the scrolling.

Thanks
gibs
4
Years of Service
User Offline
Joined: 26th Feb 2016
Location:
Posted: 24th May 2020 09:14
Where can I contact an AppGameKit developper for this issue ?

Paul Johnston
TGC Developer
17
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th May 2020 15:33
I just tried the SpaceShooter game on all my Android devices and it worked without issue. Do you experience the problem with this project on your devices? If not then it may be the format of the sound file may be incompatible with some devices and gets converted every time it is played.
gibs
4
Years of Service
User Offline
Joined: 26th Feb 2016
Location:
Posted: 28th May 2020 16:59
Hello Paul,

Thanks for answering, I have been in touch with Richard by mail.

Indeed before posting this issue, I have launched the spaceshooter, and I get slowdowns almost each time a sound is played.

Here is a video : https://www.youtube.com/watch?v=fpQoNaR9Szo

As I said I get slowdowns on :

Oppo Find X (Android 10)
Sony Xperia X F5121 (Android 8)
Nokia 8 Sirocco (Android 10)

No slowdowns on : Samsung Galaxy S6 (Android 7), iPhone 6S (iOS 12.4)

Regards
gibs
4
Years of Service
User Offline
Joined: 26th Feb 2016
Location:
Posted: 4th Jun 2020 08:52
Now that I have proven that 'playsound' disrupt the vsync (on all my Android devices including the Samsung Galaxy S6 finally) , I expect if you are serious a fix ASAP

As it's impossible to release a game with such slowdowns.

my video only show 3 instances of sounds (less than an Commodore Amiga can play without issues) but imagine the disaster if you code a SHMUP with 10 bullets + 10 explosions...

Login to post a reply

Server time is: 2020-09-29 15:02:54
Your offset time is: 2020-09-29 15:02:54