Re: auval question
Re: auval question
- Subject: Re: auval question
- From: William Stewart <email@hidden>
- Date: Mon, 9 Jul 2007 12:01:22 -0700
On 08/07/2007, at 12:57 PM, patrick machielse wrote:
Hi,
Im creating an effect Audio Unit which needs to processes 2
channels at a time, therefore I override ProcessBufferLists() and
do not use kernels. My effect's processing algorithm needs to 'look
ahead' in the audio data, and it does so by repeatedly calling
GetInput(0)->PullInput() in ProcessBufferLists(). This looks
somewhat like:
// while we need more data pull in some from the input
// 'pulledFrames' is an instance variable, initialized to 0
AudioTimeStamp pullTime;
pullTime.mFlags = kAudioTimeStampSampleTimeValid;
pullTime.mSampleTime = pulledFrames;
ComponentResult result = GetInput(0)->PullInput(ioActionFlags,
pullTime, 0, 512);
if ( result ) {
return result;
}
pulledFrames += 512;
// use the data
// ...
I believe this approach works...
No - it doesn't. An effect is expected to:
(1) Pass in the time stamp it was given in its render call
(2) Only require the same number of samples from its input as it is
being asked to produce for output
So, for look ahead requirements, the AU needs to buffer input until
it has enough to operate on. As the contract is N samples in to N
samples out, the AU will end up having to provide these "look ahead"
number of samples on the output as silent samples. This is then the
latency of the AU - how long it is going to take for an input sample
to actually appear in the output.
Now, when I run auval it returns the following error as soon as the
second slice of data is pulled from the input:
"ERROR: AU is not passing time stamp correctly. Was given: 0, but
input received: 512"
I'm not sure what to make of this. I'm purposely pulling in with
the given sample time, and at that point I've already pulled in a
slice starting at sample time 0. Is this an error in my Audio Unit?
Just ignoring the error doesn't feel quite right. Is there an
option to suppress this error?
So, the problem in the code above is the creation of the new time
stamp - just pass in the one you were given (and make sure you ask
for the number of sample frames that you were asked for) - the
implementation of AUEffectBase::ProcessBufferLists does all of this
as it should be done
Bill
patrick
_______________________________________________
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