Re: detecting mono vs. stereo?
Re: detecting mono vs. stereo?
- Subject: Re: detecting mono vs. stereo?
- From: Marc Poirier <email@hidden>
- Date: Wed, 22 Mar 2006 16:52:33 -0500
On Mar 22, 2006, at 4:27 PM, Howard Moon wrote:
I have a plug-in which supports mono or stereo, and needs to
detect whether it's being used on a mono or stereo source/track, so
that it can disable the 'pan' control if it's mono. How and where
can I get that info, as early as possible, so that I can accomplish
this? (I tried using ChangeStreamFormat, but either that's not
getting called, or else it's getting called too soon (before my
editor is available to inform it to disable the Pan control).
Is there a reliable way to accomplish this?
Initialize() is the place to do this. This has been covered in
detail in past messages on the list, but basically that is because
that is when the stream format is officially accepted (since stream
formats can be set separately on output and input, etc., check the
archives for more discussion).
I'm not sure what you mean when you say it's getting called "too
soon" for your editor. How could it ever be too soon?
Also, the bit about "before my editor is available to inform it" is
concerning too. Your AU should never be "informing" you editor, not
in any direct sense. My guess is that you are accessing some editor
class via a pointer that your audio AU instance holds, or something
like that? This is not something you should do with AUs. This has
also been covered at length on the list before, but the design of AU
is that the AU operates with no knowledge of or direct interaction
with the GUI. For one thing, there can be more than one GUI instance
for a given AU. Then any hack you make for AU->GUI communication
breaks. For another thing, the design is also made to allow for the
AU and GUI to operate in separate address spaces (though that's not
something that's happening yet).
The correct way to handle this is either for the GUI to query special
info from the AU with properties, or if the GUI needs to be updated
about changes, then the AU can use property change notifications and
the GUI can install property event listeners for the relevant
properties and react to their changes. In the case of channel count,
remember that this can be changed over the life span of an AU
instance, so you want your GUI to install a property listener and
react to any changes in the channel count (disable/enable the pan
button).
I have some example code that does just this same stuff in my RMS
Buddy plugin:
http://destroyfx.org/extras/#rmsbuddy
It changes the display layout according to how many channels there
are (since it shows a column of data for each channel). It defines
and utilizes a custom property kRMSBuddyProperty_NumChannels to
handle this stuff, so if you search the code for that constant,
you'll find all of the relevant bits of code for what you're trying
to do.
Marc
_______________________________________________
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