This is on an iPhone 3G, running at 60fps via the config file.
I have been dealing with a drop in FPS that has taken me a very long time to figure out.
After commenting out tons of code to see what the problem was, I commented out media.playSound(…) and ran it on my device.
Finally, I have a reasonably constant FPS… but with no background music.
I preload the music with:
media.playSound(“bob.mp3”) --bob.mp3 is a 64kbit rate, 22hz sound file
media.stopSound()
and then later play it via
media.playSound()
Since its the only sound loaded, playSound starts that one song.
While the music is playing, I get around 55 fps on the iPhone. It is not terrible, but it lags the game a bit and creates a presentation that I am not comfortable with.
Without the music, fps is 59-60 fps, and the game runs smoothly with no frame drops.
I dont know of a way around this. 30 fps and music seems work ok, but 60fps looks to be too fast for Corona’s media player.
Oh, actually, I did not think about trying a different sound file format. I dont really care what format it is, I just want to be able to play with no lag, so I will gladly go with .caf.
I converted the mp3 to mono, thinking it would help, but it did not.
What sound format is the fastest format to play, without lag?
What other formats are available to media.playSound()?
I think the slowdown is because it has to uncompress the sound file (MP3) while playing. The media.playSound API supports, AIF, AAC, and CAF formats along with MP3. The key is saving the file as an uncompressed sound file.