Standard Audio - Setting output ASBD returns badFormatErr

Q: I'm trying to set an SCAudio output AudioStreamBasicDescription by calling QTSetComponentProperty using the kQTSCAudioPropertyID_BasicDescription property but it always returns a badFormat (-206) error.

Setting the output format ID (mFormatID in the ASBD) as either k16BitBigEndianFormat or kFloat64Format fails.

A: The property call fails because you are using Sound Manager format types with the Standard Audio Compression Component.

The Standard Audio Compression Component does not understand these formats and therefore returns badFormatErr.

Background

The Standard Audio Compression Component (also known as StdAudio, Standard Audio, SCAudio) was added in QuickTime 7.0 and has the component SubType StandardCompressionSubTypeAudio. This component supports high-resolution audio output formats, is built on top of Core Audio and has a full set of component properties to make configuration easier.

APIs such as SCAudioFillBuffer (added in QuickTime 7.1) are available when using this component.

Standard Audio replaces Standard Sound which has the component SubType StandardCompressionSubTypeSound. Standard Sound uses the Sound Manager (deprecated) and is therefore limited to a maximum of 2 channels and sample rates of 64 kHz or less. Use of Standard Sound is no longer recommended.

Note: See the reference section for a complete discussion of Standard Audio and SCAudio APIs.

As stated above, Standard Audio is built on top of Core Audio and therefore uses Format IDs (the four character code IDs used to identify individual formats of audio data) found in CoreAudioTypes.h while k16BitBigEndianFormat and kFloat64Format are Sound Manager Format Types found in Sound.h.

IMPORTANT: You should only use Core Audio Format IDs to identify audio formats in Audio Stream Basic Descriptions.

Listing 1: Correctly describing a 16-bit Big Endian PCM format.

mFormatID = kAudioFormatLinearPCM;
mFormatFlags = kAudioFormatFlagIsBigEndian |
               kAudioFormatFlagIsSignedInteger |
               kAudioFormatFlagIsPacked;
mBitsPerChannel = 16;

Listing 2: Correctly describing a 64-bit Big Endian PCM format.

mFormatID = kAudioFormatLinearPCM;
mFormatFlags = kAudioFormatFlagIsBigEndian |
               kLinearPCMFormatFlagIsFloat |
               kAudioFormatFlagIsPacked;
mBitsPerChannel = 64;

IMPORTANT: Be aware that Standard Audio's internal processing (like all of Core Audio) is done at 32-bit Float precision.

Back to Top 

Reference:

Back to Top 

Document Revision History

DateNotes
2006-11-15First Version

Posted: 2006-11-15


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.