Bus Count and Usage
Bus Count and Usage
- Subject: Bus Count and Usage
- From: William Stewart <email@hidden>
- Date: Mon, 7 Nov 2005 19:12:49 -0800
Stefan suggested that I send a note to clarify two issues that have
come up during the "channels and frames" conversation.
(1) Bus Counts
An AU can have more than one input (or output) element by default.
For example, Apple's StereoMixer begins life with 64 inputs, 1
output. To take another example, an effect with a side-chain input
can be initially configured to have 2 inputs, 1 output. (An example
of this is Apple's AUMerger, though its actually not an effect, it is
very similar).
Implementation: The number of an AU's initial input and output
elements is an argument that is passed through to the AUBase
constructor. This specified value is cached, so that when
CreateElements() is called, the correct number of elements for each
scope will be created.
Interface: The user of an AU, after opening it, will just see the
number of initial inputs and outputs, eg (for the AUMerger as seen be
auval):
--------------------------------------------------
VERIFYING DEFAULT SCOPE FORMATS:
Input Scope Bus Configuration:
Default Bus Count:2
Format Bus 0: AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x0000002B) 32-bit big-endian float, deinterleaved
Format Bus 1: AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x0000002B) 32-bit big-endian float, deinterleaved
Output Scope Bus Configuration:
Default Bus Count:1
Default Format: AudioStreamBasicDescription: 2 ch, 44100 Hz,
'lpcm' (0x0000002B) 32-bit big-endian float, deinterleaved
--------------------------------------------------
Whether an AU's bus count is writable is a separate property and this
adds more complexity to the AU. The AU has to have knowledge that
certainly extends the kind of basic rendering code that we ship
support for in the SDK. It is also probably more than you want to
deal with for the somewhat generic cases of an effect with a side
chain input, an instrument with a known number of outputs.
So, in the AUMerger's case above, the bus count is *not* writable -
it will always have 2 inputs and 1 output. For the mixer AUs, the bus
counts are always writable (and we have code for example to
rationalise the allocations of buffers used). For writable bus counts
we really expect that there is no practical limitation on the number
of buses that a user might desire.
(2) In Use Buses
This raises another issue, and that is this. If we're recommending
that you pre-allocate a collection of buses and that the bus count is
static, what about the efficiencies involved in handling this?
For Input the matter is quite simple. You always know whether a given
input has a connection (or callback) or not. That is, you always know
whether an input is in use or not.
For Output, you do not know. In fact you only know whether output is
needed or not when it is called for. So, outputs are always
considered to be active. Lets take a couple of examples, (and you can
see this in operation in AU Lab)
(A) The DLS Music Device
- it always has 2 outputs. The second output is only engaged when
the Internal Reverb is turned off. Then, the 2 outputs become a wet
and a dry output. The reverb will (in this state) always place its
reverb mix on a reverb bus, ready and expecting for data to be
requested on both outputs. With its Internal Reverb turned on, the
second bus is not in use (but it is still there) - in this case, if
data is requested on that bus, a buffer of silence is returned with
the render silence flag set.
(B) A Generic multi-out AU Instrument
- a more generic multiple outputs instrument might be designed that
is similar to hardware interfaces (- for example, Roland's JV 1080
has 2 alternate stereo outputs that can be used to assign instrument
patches too via its interface). The user:
(a) Assigns the instrument/patch to an output bus
(b) Plugs into that output bus
So, we generally look at multiple outputs in a similar way.... The UI
can assign sound to channels / buses (or not) without actually adding
or removing the bus (output element) from the AU.... Similarly, the
AU will provide silence or sound as appropriate for each bus. This is
the way that the AU Looper works - this is a "MIDI Effect" that we
ship in /Developer/Extras/CoreAudio - it has 6 outputs: A mix output,
a queueing output, and 4 outputs (1 for each of the loops). This can
also be used in AULab to get a feel for how this can be hosted and used.
HTH
Bill
--
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