Whats the Correct way to dispose of AudioFileID and prepare for reuse
Whats the Correct way to dispose of AudioFileID and prepare for reuse
- Subject: Whats the Correct way to dispose of AudioFileID and prepare for reuse
- From: Barry Duggan <email@hidden>
- Date: Mon, 16 Jul 2012 12:57:36 +0100
I've tracked down some memory abandonment issuses in Instruments allocations. I've quite positive that the problem is coming from improper use of audiofileid.
I have a fileplayer unit and a single audiofileID that it uses.
My use case is
- Select a file.
- Open the file With audioFileID
- Repeat
How I try to do this is as follows.
AudioFileOpenURL(audioURL,kAudioFileReadPermission,0,audiofileidobject)
Uint32 defaulVal=0;
//Instruments points to this line as source of memory abondonment
AudioUnitSetProperty(fileplayerUnit,kAudioUnitProperty_ScheduleFilePrime,kAudioUnitScope_Global,0,&defaultVal,sizeof(defaultVal));
I tried to free the audioFileID from memory using the following code before opening another URL but this crashed my app.
if(audiofileidobject)
{
AudioFileClose(audiofileidobject);
}
So my question is how to properly housekeep audiofileID's for reuse?
Does AudioFileOpenURL reinitilize audiofileID memory or could there be some memory accumulation going on here?
_______________________________________________
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