Clearing buffers after resetting AUFilePlayer
Clearing buffers after resetting AUFilePlayer
- Subject: Clearing buffers after resetting AUFilePlayer
- From: Jack Nutting <email@hidden>
- Date: Thu, 09 Aug 2012 16:27:48 +0200
I'm using a whole bunch of AUFilePlayers to stream music from files.
48 of them to be precise, but no more than 7 at a time. All the files
are loops, and all have lengths that are integer multiples of a base
time period: 6, 12, or 24 seconds precisely. The user of the app can
start and stop various loops whenever they want, and when they start a
loop I calculate an offset and begin playing from somewhere in the
middle of the loop, so everything plays in sync.
This works fine, but I'm seeing memory problems on some of the iOS
devices that I'm running on. It seems that the first time I start up a
loop, I get a "penalty" in the form of some buffers that never seem to
go away. I've verified this in instruments by repeatedly starting and
that stopping a loop in the app, then marking the heap in instruments.
In one example, I get about 1.4 MB of memory that are allocated and
carry through to the last heapshot each time I iterate (sometimes
leaving a few bytes in previous heapshots as well). If I switch to a
different loop and follow the same procedure, I get another big chunk
of memory that hangs around for that loop, etc. The end result is that
if the user fills all 7 "slots" with loops and then turns them off,
the app's memory footprint has grown by a few megs. If the exact same
set of loops are started again there's no substantial growth, but if
they start 7 different ones, the app will grow further.
So my question is really this: is there any way to force an
AUFilePlayer to empty its buffers? I'm stopping playback of each unit
by calling AudioUnitReset(), and now I've also added a call to
AudioFileClose() in hopes of clearing things out, but it doesn't seem
to help.
--
// Jack Nutting
// email@hidden
// http://nuthole.com
// http://learncocoa.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden