2012/1/30 Ian Kerr <email@hidden>: > I am developing a multichannel Audio Unit effect (a meter) that > requires knowledge of channel layouts in order to function properly. > I have overridden SupportedNumChannels() to return [1, 1], [2, 2], [3, > 3], .. [6, 6], so that the number of input channels matches the number > of output channels. Now, I'd like to support as many channel layouts > as possible (that match the aforementioned channel counts); however, > I'd like the input layout to match the output layout. Is it possible > to force such a constraint? > > For example, suppose I'd like to support two 4-channel layouts: > kAudioChannelLayoutTag_AC3_3_0_1 and kAudioChannelLayoutTag_AC3_2_1_1. > Is it possible for me to force the input and output elements' layouts > to match? Or, is it always possible that the host will set the input > to kAudioChannelLayoutTag_AC3_3_0_1 and the output to > kAudioChannelLayoutTag_AC3_2_1_1?
My first thought was: Why do you care about the output format? It would seem that a meter would only care about the input format.
My second thought was that perhaps you are trying to ensure that no AU host ever makes the assumption that your meter can translate from one format to another. As alluded to by Tahome's quotation of the documentation, a "format setting" can validate whether given channel layouts are accepted. Thus, if your AU gets kAudioChannelLayoutTag_AC3_3_0_1 on input and kAudioChannelLayoutTag_AC3_2_1_1 on output, then your implementation of the set format function can return a failure message to disallow combinations like that.
Brian Willoughby Sound Consulting
On Feb 2, 2012, at 23:31, tahome izwah wrote: From the docs:
kAudioUnitProperty_SupportedNumChannels
If not implemented, the Audio Unit may be agnostic about the number of channels and only a format setting can validate whether the channels are accepted. Generally, this will mean (particularly with Effect Units) that any number of channels are usable as long as there is the same number of channels on both the input and output scopes. Other units can accept a mismatch in the channelization of their busses, thus this property is provide to allow those units to publish the allowable channel configurations that can be accepted on input and output. Returns pairs of numbers of channels (e.g. 1 in / 1 out, 1 in / 2 out, 2 in / 2 out, etc.). If a value of -1 is seen, then this can be interpreted as "any" number of channels for that scope. So, the default setting for an Effect Unit would be -1/-1, and for these types of units it is not expected that they publish this property if this value (same number of channels in and out, with no restriction on the number of channels) is supported.
Hmm, it would seem that it is not possible for an AU to simply say that it accepts any number of channels in and out, with no restriction on whether the number of channels are the same. AUMixer would probably be an example of an AU that would have such broad capabilities. Then again, I suppose such a case would simply use the set format return code to accept (or fail, if necessary). Brian Willoughby Sound Consulting
|