Re: Matrix Mixer and AUGraph tidbit
Re: Matrix Mixer and AUGraph tidbit
- Subject: Re: Matrix Mixer and AUGraph tidbit
- From: William Stewart <email@hidden>
- Date: Wed, 21 Jan 2004 11:30:18 -0800
Once you connect an AU into a running (or more fundamentally
initialized) graph, the AU will be initialized.
So, the problem with the Matrix Mixer in this area is twofold.
(1) The MM needs to know how many input and output elements (or buses)
and the formats (essentially the number of channels) for each of those
(2) When Initialized, the MM will have all of its volumes set to zero -
so you have to manage this and set these after its been initialized
The best way I think to manage this is the following order (lets assume
the graph is running and the MM isn't actually connected, but is a node
in the graph).
(1) Set the element count of the MM for inputs and outputs
(2) Set the format of each element
(this format has to match on each side (ie. the source AU's output and
destination AU's input must be the same)
(3) Make the connections to those elements (this means calling AUGraph
API to make the connection)
- the connection won't happen here yet
(4) Initialize the MM unit and set the volumes
(5) Call AUGraphUpdate
- This actually establishes the connections in a thread-safe manner
- This will also initialize the AU (but as you've already initialized
it, this is a no-op)
- both of these operations happen on the render thread of the graph,
so its important that the actual initialization of the AU doesn't occur
here
The state of the graph (ie. connections, etc) won't occur until you
call Update
You can change volumes of course whilst the MM is running (initialized)
You can also add/remove connections to the MM as long as you don't have
a format change as part of this whilst the MM is running
If you need to change either the format of an element (in or out), or
say add a new input element, you have to uninitialize the MM and
re-initialize it as described above
Bill
On 16/01/2004, at 12:38 PM, James Coker wrote:
After further testing, I find that I need to amend my prior comment:
In addition to manually calling AudioUnitInitialize on a
MatrixMixer before adding to an *already running* AUGraph,
I also have to create that MatrixMixer (via AUGraphNewNode)
*before* I start the AUGraph.
Since I haven't seen this with any other AUs, I have to
ask: "What is going on here? Is this due to setting up
I/O streams for the MatrixMixer, or is there some critical
semantic about the AUGraph that I have missed?"
Thanks,
Jim
On Jan 15, 2004, at 8:24 PM, James Coker wrote:
I just found out that if I want to create a MatrixMixer AU and add
it to a running AUGraph, I need to manually call AudioUnitInitialize
on the
mixer before adding it to the graph, otherwise it does nothing.
The general order I'm using is:
- create the MatrixMixer
- configure it's inputs and outputs (as in the MatrixMixerTest
example)-
- initialize it
- connect it to other AUGraph nodes
- enable it's inputs/outputs as needed
- setup all volumes
Based on the comments by Bill in the message below, I don't think this
is a bug, but wanted to point it out.... (Glad I saved this message!)
Cheers,
Jim
On Oct 6, 2003, at 4:19 PM, William Stewart wrote:
AUGraph doesn't make these decisions.
The errors are being returned by the AU you are connecting too (the
connection semantics are enforced by the AU - ie. the connection
needs to have the same format from output to input - if that format
is invalid then the connection will return an error). Its left to
the user of the graph to ensure that the connection will be valid
and to deal with it when it isn't.
We modified this behaviour between Jaguar and Panther given the
discussions we'd had about AU's and format negotiation (ie. can't
generally reset formats if the AU is initialized) - so the AUGraph
code's order of operations was modified to reflect this semantic.
Thus, now, the AUGraph will *not* initialize an AU until it is
involved in a connection, and it will initialize the AU *after* the
connection is made. Obviously, as a connection can involve both
input and output sides, this is not foolproof. Also, if the graph is
running, this connection/initialization will be made on the render
thread - generally not a good idea.
So the general advise is, make sure the formats are correct and the
AU is initialized before connecting it to a playing graph. (That
also allows you to determine if the AU can become a member of the
graph at the location, etc, you want it to be).
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
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
________________________________________________________________________
__
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.