Re: AU Render() and multi-out MusicDevice
Re: AU Render() and multi-out MusicDevice
- Subject: Re: AU Render() and multi-out MusicDevice
- From: William Stewart <email@hidden>
- Date: Thu, 30 Sep 2004 20:42:08 -0700
Just for a matter of clarity - part of the problem we've had with AU
developers is the confusion between output elements (which are distinct
buses/outputs) and channels that can be contained in a single output.
So, (and I know I'm being pedantic, so you'll have to forgive my
nit-picking) from an AU's point of view, what you are calling fNumOuputs is
channels on a single output. Its an important distinction that was *not*
made and has caused us problems...
On 30/9/04 8:48 AM, "Malcolm Haylock" <email@hidden> wrote:
> Hi All,
>
> I'm having troubles with a prerelease of a popular AU host and an
> 8-out AU instrument.
>
> A simple Render routine to create silence is as follows. Note that
> fNumOutputs is 8.
How do you know? Is this the number of channels that has been set on this
output bus? When your AU is initialized, you can ascertain the number of
channels that are being set on each input and output element - and this
won't change until you are re-initialized.
With Logic's correct hosting of AU's with multi-output capability with Logic
7, you will generally NOT see an output bus of 8 channels unless you are
doing 8 channels of a surround format (in which case you need to support the
AudioChannelLayout properties to describe the format/ordering/layout of
these channels).
The reason that I'm raising this, is that I'm assuming that you are
basically talking about how this was originally done with older versions of
Logic - which is incorrect and is no-longer supported going forward (though
I believe Logic is allowing these AU's in the latest release as a
temporary/compatibility measure - though Stefan should confirm that to be
sure).
> ComponentResult xxx::Render(
> AudioUnitRenderActionFlags& ioActionFlags,
> const AudioTimeStamp& inTimeStamp,
> UInt32 sampleFrames )
> {
> float* outs[fNumOutputs];
>
> // Get output buffer list and extract the i/o buffer pointers.
> if (fNumOutputs>0)
> {
> AudioBufferList& asOutBufs=GetOutput(0)->GetBufferList();
> for (long o=0; o<fNumOutputs; ++o){
> outs[o]=(float*)(asOutBufs.mBuffers[o].mData);
> if(asOutBufs.mBuffers[o].mDataByteSize<=0 || o>=asOutBufs.mNumberBuffers)
> outs[o]=nil;
> }
> }
>
> // silence
> for (long o=0; o<fNumOutputs; ++o)
> if(outs[o])
> memset(outs[o], 0, sizeof(float)*sampleFrames);
>
> return noErr;
> }
>
> Under a pevious version of the host all works fine, with
> asOutBufs.mNumberBuffers=8. Under the latest version
> asOutBufs.mNumberBuffers=2. Therefore the above code does nothing
> to the other 6 channels resulting in noise on these channels.
But where are you outputting those channels?
If you have 4 output elements (each of which has 2 channels), then you are
always just going to be setting silence on the first 2 of your 8 channels -
regardless of whether you are called on any of the four buses.
AUBase's render also includes an element (bus) number that you are being
asked to produce data for - which you aren't passing through to your render
call here - thus you're always zeroing the same two channels...
That's why for instance, you call GetOutput(0) and not
GetOutput(inOutElNumber)
If you're going to use something like the scheme above, you'd then have to
offset into your pointer array based on the element you're beings asked to
render for...
Bill
>
> Please let me know if anything is wrong with my methodology above.
>
> Thanks,
> Malcolm Haylock
> _______________________________________________
> 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
__________________________________________________________________________
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
__________________________________________________________________________
_______________________________________________
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