hiccups on Android 4.xx

Monkey Targets Forums/Android/hiccups on Android 4.xx

Midimaster(Posted 2013) [#1]
Users report on stuttering and hiccups of my score-trainer app on Android 4.xx.

Notes scroll into the screen and the user has to play them on the piano. Everytime, when the user gives a correct answer, the app save the live score in a SaveState().

On 2.3 this had no visible effects. But on 4.xx the scrolling of the following note starts, then stops after ~300msec for ~300msec, then continue.

Another source of stuttering are the sounds. Each time the user press a piano key, a sound is started.

On 2.3 the Sounds are performed without problems, on 4.xx they need 80msec. It is not visible... I can see this only, because I draw the time taken ( OnRender()+OnUpdate() ) on the screen.

On 2.3 the time consumption never reaches more than 2msec. On 4.xx it is also in general <2msec, but when a sound starts, it rises upto 80msec.

Does anybody made similiar experiences?


CGV(Posted 2013) [#2]
I can't comment on the sound issue but saving the score continuously like that is going to cause hiccups on most platforms, certainly on mobile and in flash and html5.

I make my flash games using Flixel/Flashdevelop and the problem has always existed there too, so it's not a Monkey thing.


Gerry Quinn(Posted 2013) [#3]
I think you need to save state only periodically. (If nothing else it will save wear and tear on solid-state memory.)

I have been thinking about this with a puzzle game I am doing. My intention is to save in OnSuspend(), on exiting, and also every fifteen minutes or so, but only if something has changed.

Anyone else have thoughts on how it should be done?


Midimaster(Posted 2013) [#4]
I know how to handle this problem... but that was not the question.

What has changed it 4.xx compared to 2.xx? In 2.xx there were no hiccups.


bram(Posted 2013) [#5]
Perhaps the sound engine shuts down when it is inactive? I had such a problem in Flash, when I tried to add sound to a bouncing ball. Playing background music, or an empty sound in the background was the workaround to keep the soundengine 'alive'.


Gerry Quinn(Posted 2013) [#6]
I could never get MP3s to start immediately in Flash. I think it may be something about the format that makes them tend to have a built-in delay. But MidiMaster's problem seems to be new, so it must be something else.


bram(Posted 2013) [#7]
There is indeed a pause before any MP3 file. But that was not what was causing my problem then. The delay was caused by the sound engine, which shut itself down after a certain time of inactivity. When a sound was played, the sound engine restarts, then plays the sound. That process caused the latency. When I read 'stutter' and 'sound', it reminds me of that problem. I can imagine such an optimization between Android 2 and 4.