Archive for the ‘iPhone’ Category

Audio Services Freezing App

Thursday, January 1st, 2009

If you are using Audio Services to play sound effects, then you’re going to have problems if you’re also updating your program state at a high frame rate. 

Although incredibly simple to use, the Audio Services should really only be used for one off alerts or sounds, and never as the sound effect backend of a game or similar. 

Like most Apple APIs, they use the technique of lazy loading.  That is, don’t bother doing anything like setting up audio buffers etc until you actually call the API into action for the first time.  This is useful for faster loading apps, and a smaller average memory footprint. 

But the downside to this is that the first time you try to play a sound, the Audio Services will be initialized and your app will pause for tenths of a second.  After this, however, all will be fine. 

A better way to go is to use OpenAL to handle audio playback.  It is much more flexible, and allows you to call the initialize function when your application loads, to avoid delays when you actually want sound to be played.  

The best place to start with this is to look at the Apple ‘Crash Landing’ example.  It includes a ‘SoundEngine’ module that can pretty much just be copied into your applications for use.  Remember to include the OpenAL framework though.

App Feedback on Deletion

Wednesday, December 17th, 2008

Perhaps it’s just me, but does anyone else think that the new feedback question asked in iPhone OS 2.2 when an app is deleted is a bad idea? 

If you’re not familiar with the new feature, it is just a simple pop up that appears when you delete an app from your phone and asks you to rate it out of five stars, or just say no-thanks. 

When analyzing data in any field from scientific analysis to reviews that others have made, you should always be on the lookout for confounding factors.  And what’s more confounding than skewing your data to be mostly from people who have deleted an app they paid money for?  

I’m sure the system works moderately well for free apps.  There’s less to loose if you delete a free app – you can always download it again (if it’s still free..).  And there are reasons why you wouldn’t want hundreds of free apps cluttering up your phone.  But if you’ve paid for the app then it’s a different story.  You’re either cleaning up your phone and it’s at the bottom of the ‘want-to-keep’ pile, or you just plain don’t like it and want it gone.  It’s just far easier (and economical) to keep an app if you like it. 

So where does that leave us? Now we have many reviews from people who don’t like your app or think it’s the worst one on their phone.  Personally I’ve noticed a decline in all my ratings with an influx of non-comment reviews.  

An obvious way around this would be to ask to rate after the nth running of the app.  It would be a nuisance but far less biased towards people who don’t like the app. 

Has anyone else seen this phenomenon? Any other solutions?

OpenGL ES 1.1 and the iPhone

Wednesday, December 3rd, 2008

What can make an iPhone developer sulk and refuse to program for two hours?  OpenGL ES is the answer, and it has nothing to do with OpenGL ES per se. 

Largely it’s my fault.  I should have done my research upfront. But with all the talk of the OpenGL ES 2.0 standard, I started to assume that it was supported on the iPhone.  After three hours of learning about vertex and fragment shaders in OpenGL ES 2.0, and writing a few to render a 2D blob for my upcoming iPhone physics engine (more on this later..) I got stuck trying to make it work on the iPhone itself.  

Not surprising really.  The hardware in the iPhone only supports the OpenGL ES 1.1 standard, and as such the API has no calls to any vector or fragment program related goodness.  

Lucky for me, I was just trying to do some shadows and shading of 2D sprites, so I could kinda fake it using some blending and scaling, but I guess the more adventurous effects will just have to wail until the next iPhone generation or later. 

So before you end up crossed armed and sulking as hard as you can at your computer, only do things based on the 1.1 standard, not the 2.0.