Re: Allocating an AudioBufferList
Re: Allocating an AudioBufferList
- Subject: Re: Allocating an AudioBufferList
- From: Doug Wyatt <email@hidden>
- Date: Tue, 29 Nov 2005 15:00:45 -0800
On Nov 24, 2005, at 12:39, Simon Brée wrote:
Hello everyone,
What is hte good way to allocate an AudioBufferList ?
I've found on the web this method :
size = sizeof(inputDesc);
err = AudioUnitSetProperty(inputUnit,
kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1,
&inputDesc, size);
inputBuffer = (AudioBufferList *)malloc(offsetof(AudioBufferList,
mBuffers[inputDesc.mChannelsPerFrame]));
But I've got the error :
error: 'inputDesc' cannot appear in a constant-expression
What i've done wrong ?
Used an example that was written before gcc became more strict/
compliant.
You could use something like this:
AudioBufferList *AllocateAudioBufferList(UInt32 nchannels)
{
return (AudioBufferList *)malloc(offsetof(AudioBufferList, mBuffers)
+ nchannels * sizeof(AudioBuffer));
}
There are also several different approaches in the SDK, ranging from
CAAudioBufferList (fairly minimal) to AUBuffer/AUBufferList (focused
on audio unit scenarios) to CABufferList (probably more elaborate
than needed for most situations).
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
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