title: What do you use to play sound in iPhone games?
body: <p>I have a performance-intensive iPhone game I would like to add sounds to. There seem to be about three main choices: (1) <code>AVAudioPlayer</code>, (2) Audio Queues and (3) OpenAL. I’d hate to write pages of low-level code just to play a sample, so that I would like to use <code>AVAudioPlayer</code>. The problem is that it seems to kill the performace – I’ve done a simple measuring using <code>CFAbsoluteTimeGetCurrent</code> and the <code>play</code> message seems to take somewhere from 9 to 30 ms to finish. That’s quite miserable, considering that 25 ms == 40 fps.</p>
  
  <p>Of course there is the <code>prepareToPlay</code> method that should speed things up. That’s why I wrote a simple class that keeps several <code>AVAudioPlayer</code>s at its disposal, prepares them beforehand and then plays the sample using the prepared player. No cigar, still it takes the ~20 ms I mentioned above.</p>
  
  <p>Such performance is unusable for games, so what do you use to play sounds with a decent performance on iPhone? Am I doing something wrong with the <code>AVAudioPlayer</code>? Do you play sounds with Audio Queues? (I’ve written something akin to AVAudioPlayer before 2.2 came out and I would love to spare that experience.) Do you use OpenAL? If yes, is there a <em>simple</em> way to play sounds with OpenAL, or do you have to write pages of code?</p>
  
  <hr>
  
  <p><em>Update:</em> Yes, playing sounds with OpenAL is <a href="http://github.com/zoul/Finch/" rel="noreferrer">fairly simple</a>.</p>
  
  <hr>