AU Format Negotiation - State of Affairs
AU Format Negotiation - State of Affairs
- Subject: AU Format Negotiation - State of Affairs
- From: Art Gillespie <email@hidden>
- Date: Fri, 17 Oct 2003 10:22:30 -0400
Hi All,
I've been testing two of the prominent Audio Unit hosts with an eye
towards their multiple output support for music devices, but also more
generally to their format negotiation.
My test audio unit creates four output elements, each with a stereo
pair. kAudioUnitProperty_StreamFormat is writable, but I return
kAudioErr_FormatNotSupported to
SetProperty(kAudioUnitProperty_StreamFormat...) for anything that isn't
2 channels. kAudioUnitProperty_SupportedNumChannels returns 0.
LOGIC 6.x
- Doesn't appear to support busses at all: Never calls
kAudioUnitProperty_BusCount selector. Never makes any selector call on
the output scope for any element other than 0.
- If I remove my format check in
SetProperty(kAudioUnitProperty_StreamFormat...) so that any channel
configuration is valid (e.g. FormatIsCanonical(...) returns true),
Logic will set the number of channels on the first element of the
output scope to 16 (!), subsequently causing my test AU to bail out on
an assert(bufList.mNumberChannels == 2) in my Render() method. With my
format check only accepting 2-channel formats, my test audio unit
doesn't appear in Logic's Multi Channel menu.
To date, I've hacked multi-output support for Logic into pHATmatik PRO
by putting eight channels on the first output bus. I know of at least
one other developer who has done the same with his excellent Audio
Units. This was fine (I guess) while Logic pretty much represented the
sum total of commercial AU hosts (and certainly the only one with
multiple output support). Unfortunately, I'm starting to get contacted
by host developers adding Audio Unit support to their products asking
me if this is the 'accepted' way to do things.
Since the specification isn't ambiguous on this point (this isn't VST,
after all), I'm going to fix multiple output support in pHATmatik PRO's
next release (hence breaking it in Logic and causing me no end of
support fun). I would encourage other developers with multiple-output
Audio Units to do the same before host developers start working around
our workarounds and we find ourselves with lovely code like so:
if (strcmp(hoststring, "Host That Works - Sorta") == 0)
{
switch (hostversion)
case 0x00101011:
//handle non-standard implementation of foo
break;
case 0x00102001:
//non-standard implementation of foo fixed
//but completely broken bar must be dealt with
break;
}
if (strcmp(hoststring, "Host That Barely Works") == 0)
{
...
and so on, ad nauseum. (Cheers to the coreaudio team for *not* putting
a host identification mechanism in.)
Digital Performer 4.1
- I don't think Digital Performer supports multi-output instruments
(please someone correct me if I'm mistaken), so the fact that it
doesn't inspect the bus count isn't surprising. However, if an audio
unit doesn't respond to SupportedNumChannels during validation, DP
lists stereo and mono configurations for that audio unit in its
instrument menu. If I try to load the mono version, it fails silently
(because SetProperty(kAudioUnitProperty_StreamFormat...) returns
kAudioUnitErr_FormatNotSupported.
Since kAudioUnitProperty_SupportedNumChannels isn't a required
property, I would humbly suggest that hosts that determine output
configurations at 'validation-time' and display them in this manner
also call SetProperty(kAudioUnitProperty_StreamFormat...) during
validation to ensure they are supported.
AUValidatorTool
- Works as expected :-)
I'm happy to make the source of my test audio unit available to anyone
that's interested. And please, if I've misunderstood something, don't
hesitate to rail me on the list. The more this stuff is discussed, the
better understanding we'll all have.
Best,
Art
>>0xBA
_______________________________________________
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.