Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
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.
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
.
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; |
Reference:
Document Revision History
Date | Notes |
---|---|
2006-11-15 | New document that discusses why badFormatErr may be returned from Standard Audio |
Copyright © 2006 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2006-11-15