tags:

views:

27

answers:

1

Does it load the entire file at a time? Or does it act lazy and load a chunk at a time? I'm primarily interested in knowing how much memory my audio uses.

A: 

From what I understand of it, it buffers the file and you can have even more control over this process by using Audio Queues. Most implementations of OpenAL will load the entire file all at once which can be pretty intensive.

You can pre-buffer using prepareToPlay but honestly, I've never had any noticeable lag using wav's, caff's or mp4's. Calling the play method has to pre-buffer the audio anyways.

In all of my uses of AVAudioPlayer, it normally only causes a temporary jump in memory allocation. As long as you release the player after it is finished, memory isn't a problem. I've played as many as 15 sounds at once and never had issue.

More info on audio: http://developer.apple.com/iphone/library/documentation/iphone/conceptual/iphoneosprogrammingguide/AudioandVideoTechnologies/AudioandVideoTechnologies.html

iWasRobbed
I agree. I had similar experiences when testing it. It's just that I want my users to have fair idea of how much memory they are using when they use my abstractions.
Plumenator
If you want an exact amount, make sure to `Run` on the device using the `Object Allocations` tool. It's in the performance tools menu under `Run`
iWasRobbed