Automatically initialising an AudioBufferList for input of data
Automatically initialising an AudioBufferList for input of data
- Subject: Automatically initialising an AudioBufferList for input of data
- From: Heath Raftery <email@hidden>
- Date: Thu, 16 Jun 2005 23:11:42 +1000
If I have a prepared AudioUnit that represents an input-enabled
AudioOutputUnit, is there a way to allocate and initialise the
contents of an AudioBufferList such that it would be ready to accept
data from such an AudioUnit? The reason I'm prompted to ask, is that
there appears to be an equivalent for AudioDevice, but that is not
much use for the input of data.
Say I have a:
<code>
AudioBufferList *fInputBufferList;
</code>
and I want to use it like the following:
<code>
AudioUnitRender(fInputUnit, ioActionFlags, inTimeStamp, inBusNumber,
inNumberFrames, fInputBufferList);
</code>
that is called from my audioArrived() function, set up like so:
<code>
AURenderCallbackStruct input;
input.inputProc = audioArrived;
input.inputProcRefCon = self;
AudioUnitSetProperty(fInputUnit,
kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0,
&input, sizeof(input));
</code>
I am currently setting up my fInputBufferList by hand, based on trial
and error. That's not particularly robust given the various
fInputUnits I might be dealing with. The AudioDevice API has this,
which appears to deal with the problem:
<code>
AudioDeviceGetPropertyInfo(fInputDeviceID, 0, YES,
kAudioDevicePropertyStreamConfiguration, &theSize, NULL);
fInputBufferList = (AudioBufferList *)malloc(theSize);
AudioDeviceGetProperty(fInputDeviceID, 0, YES,
kAudioDevicePropertyStreamConfiguration, &theSize, fInputBufferList);
</code>
But my fInputDeviceID properties are different to the output format
of the fAudioUnit (specifically the data is deinterleaved inside the
unit), so the fInputBufferList that comes back is fairly useless. I
couldn't see anything in AudioUnit that might do what I want.
Heath
_______________________________________________
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