Re: Audio Unit render problem
Re: Audio Unit render problem
- Subject: Re: Audio Unit render problem
- From: William Stewart <email@hidden>
- Date: Mon, 21 May 2007 14:40:03 -0700
You don't actually have the input here - all you have done is to get
the buffer list.
So, firstly you have to get the input by:
GetInput(0)->PullInput(...)
Also, be careful about C++ isms... The method signature :
AudioBufferList & GetBufferList() const { return
mIOBuffer.GetBufferList(); }
returns a reference to the buffer list. You declare it/call it to
return a copy, but the problem is that this copy will probably
overwrite the stack as a ABL is a variable sized structure, so you
don't have enough space to copy the buffer list you are getting from
this call to your local variable. (My guess, is that this is actually
where you are creating the -1 error from).
Have a look at how the render call is handled in AUEffectBase; its a
little convoluted (because it deals with all of the kernels and
scheduling requirements), but you should be able to follow the basic
structure here I think.
If you can process one channel at a time, then subclassing
AUEffectBase is going to be much easier - have a look at the
SampleEffectUnit for the kinds of things you have to do (/Developer/
Examples/CoreAudio/AudioUnits)
Bill
On 14/05/2007, at 10:21 AM, Russell Edwards wrote:
Hi All
I have come across a problem with the render method of an Audio
Unit MIDI Effect that i am building. The effect fails validation
with AUVal.
AUVal returns the following:
RENDER TESTS:
Input Format: AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x0000002B) 32-bit big-endian float, deinterleaved
Output Format: AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x0000002B) 32-bit big-endian float, deinterleaved
Render Test at 512 frames
ERROR: -1 IN CALL AudioUnitRender
* * FAIL
As i am currently experimenting to get the hang of AUs, and in
particular MIDI Effects, the render method / function that i have
been testing should just copy the data from the input to the output
without any DSP.
ComponentResult SwellSym::Render(AudioUnitRenderActionFlags&
ioActionFlags,
const AudioTimeStamp& inTimeStamp,
UInt32 inNumberFrames
)
{
//The DSP code goes here.
//the default format is float32 non-interleaved linear so we will
use that as a starting point.
AudioBufferList inList;
AudioBufferList outList;
Float32 *inDataArray;
Float32 *outDataArray;
//get the buffer list for the input and output.
inList = GetInput(0)->GetBufferList();
outList = GetOutput(0)->GetBufferList();
//for each of the buffers in the lists get the data and pass it to
the output.
for (UInt32 n = 0; n<inList.mNumberBuffers; n++)
{
inDataArray = (Float32 *)inList.mBuffers[n].mData; //get the
pointer to the array of data and cast it's void type to float32
outDataArray = (Float32 *)outList.mBuffers[n].mData; //get the
pointer to the array of data and cast it's void type to float32
for (UInt32 i=0; i<inNumberFrames; i++)
{
//copy each frame accross.
outDataArray[i] = inDataArray[i];
}
}
return noErr;
}
Can see where I have gone wrong?
As i said in my previous email, regarding this and another problem.
I couldn't find a reference in the AU documentation as to what the
return values should be, so i have just tried some common values
(hence the noErr) but with no luck.
Many Thanks
Russell Edwards
_______________________________________________
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
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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