title: Which API to play audio from a buffer in ios and osx?
body: <p>I would like to do this very simple thing: playing PCM audio data from memory.</p>
  
  <p>The audio samples will come from sound-synthesis algorithms, pre-loaded sample files or whatever. My question is really about how to play the buffers, not how to fill them with data.</p>
  
  <p>So I'm looking for the best way to re-implement my old, deprecated <em>AudioWrapper</em> (which was based on AudioUnits V1), but I could not find in the <a href="https://developer.apple.com/library/ios/#documentation/MusicAudio/Conceptual/CoreAudioOverview/CoreAudioEssentials/CoreAudioEssentials.html" rel="nofollow noreferrer">Apple Documentation</a> an API that would fulfill the following:</p>
  
  <ul>
  <li>Compatible with 10.5 through 10.7.</li>
  <li>Available in ios.</li>
  <li>Does not rely on a third-party library.</li>
  <li>Be future proof (for example: not based on Carbon, 64 bits...).</li>
  </ul>
  
  <p>I'm considering using OpenAL, but is it really the best option ? I've seen <a href="https://stackoverflow.com/questions/4014614/ios-audio-units-vs-openal-vs-core-audio">negative opinions</a> about it, it might be too complex and overkill, and might add performance overhead ?</p>
  
  <p>At worse, I could have two different implementations of that <em>AudioWrapper</em>, but if possible, I'd really like to avoid having one version for each system (ios, 10.5, 10.6, 10.7...). Also, it will be in C++.</p>
  
  <p><strong>EDIT:</strong> I need a good latency, the system must respond to user interactions in under 20 ms (the buffers must be between 128 and 512 samples at 44KHz)</p>