Re: AU2 - saying "no" to interleaved streams
Re: AU2 - saying "no" to interleaved streams
- Subject: Re: AU2 - saying "no" to interleaved streams
- From: Doug Wyatt <email@hidden>
- Date: Mon, 23 Sep 2002 17:13:52 -0700
On Monday, Sep 16, 2002, at 13:16 US/Pacific, Marc Poirier wrote:
How should an Audio Unit tell the host that it won't process process
interleaved streams and that it requires deinterleaved streams? Is
overriding ChangeStreamFormat() and returning an error from it the
recommended approach (if interleaved was attempted), or is there a
recommended way to warn the host first?
Tracing through the whole code flow here ...
AUBase::DispatchSetProperty for kAudioUnitProperty_StreamFormat
calls:
IsStreamFormatWritable - can cause faliure if format is not changeable
uses virtual method StreamFormatWritable
ValidFormat - virtual
default implementation calls FormatIsCanonical
ChangeStreamFormat - virtual
AUBase::FormatIsCanonical looks like this:
return (f.mFormatID == kAudioFormatLinearPCM
### basic sanity checks
&& f.mFramesPerPacket == 1
&& f.mBytesPerPacket == f.mBytesPerFrame
// so far, it's a valid PCM format
### must be float
&& (f.mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0
********** must be noninterleaved for V2, interleaved for V1 **********
&& ((f.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0) ==
(mAudioUnitAPIVersion == 1)
### must be native-endian
#if TARGET_RT_BIG_ENDIAN
&& (f.mFormatFlags & kLinearPCMFormatFlagIsBigEndian) != 0
#else
&& (f.mFormatFlags & kLinearPCMFormatFlagIsBigEndian) == 0
#endif
### must be Float32
&& f.mBitsPerChannel == 32
### sanity
&& f.mBytesPerFrame == f.NumberInterleavedChannels() * sizeof(Float32)
);
So actually you shouldn't have to add any extra code -- if you are
publishing yourself as a V2 unit, this code in AUBase should be
rejecting attempts to use interleaved stream formats.
Doug
--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden
http://www.sonosphere.com
_______________________________________________
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.