Re: AU Format Negotiation
Re: AU Format Negotiation
- Subject: Re: AU Format Negotiation
- From: William Stewart <email@hidden>
- Date: Wed, 10 Dec 2003 16:04:57 -0800
On 10/12/2003, at 1:00 PM, Patrick Gostovic wrote:
>
>
On 10-Dec-03, at 3:22 PM, William Stewart wrote:
>
>
> First of all - you should *never* and I mean *never* set the stream
>
> format of either an input or an output from within an Audio Unit. And
>
> I do mean *never*...
>
>
>
> The format for a scope/element pair is set externally by the client,
>
> and the format as such establishes a shared understanding between say
>
> an output element from a source AU and an input element on a
>
> destination AU.
>
>
>
> When a connection is made by the client, the format from the source
>
> unit is propagated to the input of the destination.
>
>
Thanks for the info, but...
>
>
How is the format of the source unit determined if not from within? I
>
have made an AU that outputs MIDI beat clock and song position pointer
>
events (in MIDIPacketLists) and I would like clients to know that the
>
output stream format is of type kAudioFormatMIDIStream. Is there
>
nothing that I can do so that when a client gets the
>
kAudioUnitProperty_StreamFormat property from my AU's output element,
>
the format ID will be kAudioFormatMIDIStream? Am I missing something
>
obvious?
Each subclass of AUIOElement has a Setter and a Getter for its Format.
This is what the based classes use for the API calls to set/get formats
in response to either the format properties or the connection property.
Yes, you're correct (I should have qualified my *never*, to *never
behind the back* of the API call).
So, the constructor of your AU would look something like this:
CreateElements(); // this is important to get the elements created,
and as this involves virtual methods, this has to be done in the leaf
classes' constructor
GetOutput(0).SetMIDIFormat(); // or whatever your collorary is. The
CreateElements class will have constructed your AUElement subclass.
So, in your AU's constructor you will need to set the format of this
element to the MIDI format - then that is propogated. When we took a
cursory look at this, it seemed to us that there were a slew of
dependencies on a PCM format in this AUIOElement class (and its
sub-classes), so the failure of a MIDI format to take is probably due
to something like this.
As you look through this, you might want to see if there is too many
PCM assumptions if your are deriving from AUIOElement (and thus derive
from AUScopeElement) - and redo the PullInput in your subclass. This is
an area that we are planning on doing some revisions on ourselves -
you're jumping ahead of us, so we can help you as we can as you wade
through this...
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
________________________________________________________________________
__
_______________________________________________
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.