views:

136

answers:

2

Is it possible to use the iPhone's hardware accelerated decoding of mp3s and AAC when using the OpenAL library?

I suppose there are two possible approaches if this is possible.
iPhone specific OpenAL extensions.
iPhone APIs to decode audio into raw bytes.

I have two specific use cases.

  • Completely decode a short sound bite.
  • Piecewise decode a larger sound file so it can be streamed into OpenAL rather than loaded all at once.

update

Boy! no one's got an answer for this? Does Apple's NDA stiffle these kinds of questions? What's going on? Surely someone else using OpenAL has wanted better audio performance.

A: 

AFAIK, there is no hardware audio decoder in the iPhone, 3S, and 3GS. This might have changed in the iPhone 4, but I have not heard anything to make be believe so.

CuriousRabbit
I think you're wrong. I can't find anything official but there is lots of discussion online about preferring mp3's over ogg when targeting the iPhone. Mp3's are faster to load(decode) and consume less battery. Both of those seem to imply mp3 hardware.
caspin
@caspin or they could imply a less-than-optimal ogg encoding/decoding algorithm compared with the mp3 algorithm. Your hypothesis is certainly plausible but not required for the claims you are seeing.
San Jacinto
@caspin Apologies for getting this wrong. I found the reference from which my mistaken impression was derived:Greenstone, Brian. "Jedi Master List for Game Optimization." iPhone Games Projects. Ed. David Mark. Berkeley, CA: Apress, 2009. Print.From the “Audio Optimization” topic: “The iPhone and iPod touch are audio devices, and as such, you’d think that they have a lot of awesome audio hardware in them to make audio playback inexpensive, but this is not the case. The iPhone actually has very limited audio hardware, and most of the audio processing is actually done in software.”
CuriousRabbit
+2  A: 

There is at least one hardware (or hardware assisted) decoder in all iPhone device models. It can be accessed to convert mp3 and AAC files into raw PCM bytes by using the Audio Queue Services API. From thence you can process those bytes or send them to OpenAL.

hotpaw2
Not exactly what I was looking for. I would have liked some example calls into the API. At least now I have better keywords to google.
caspin