Page 1 of 1

mobilePlaySoundOnChannel cached?

Posted: Thu Sep 17, 2015 9:00 pm
by rinzwind
One can't replay a sound already played on a channel (at least there is no such command). You always have to specify the full path again. This worries me... does iOS have to get the file each and every time from disk? While testing a small app with a very short wav file (not in simulator, but on ipad air 2) the first play call takes around 100 ms, subsequent calls 20-30 ms (which is still quite a while for your average game loop which has only 16 ms per frame for ±60hz...). If you do nothing some secs and replay it, it is again 100 ms. I know about "next" instead of "now", but that still only works once. So is it cached by filename or not? If not... any improvements planned? Seems it still can use some optimization.

Re: mobilePlaySoundOnChannel cached?

Posted: Thu Sep 17, 2015 9:12 pm
by rinzwind
Well some experimenting.. mobilePlaySoundOnChannel is blocking while the sound is loaded, not async which would be usefull for such a function (async is return immediately and go on while the sound is loaded (and then played)).. can get around that with a send "playsound" to me in 0 millisec. Then your main loop won't have to wait for the sound to load and can go on with whatever it does..

Re: mobilePlaySoundOnChannel cached?

Posted: Mon Sep 21, 2015 7:41 pm
by rinzwind
Enhancement request made.. http://quality.runrev.com/show_bug.cgi?id=15951
Playing a (really short) sound for the first time (or after 10 seconds again) does slow down the app for an instant on a fast ipad air 2, even with a send command. It's a shame, cause the animation runs good apart from that part of a second.