MTCoreAudioStreamDescription

Conforms to: NSCopying

An MTCoreAudioStreamDescription encapsulates a CoreAudio AudioStreamBasicDescription, which describes the audio data format associated with an audio device and its streams.

Method Types


Class Methods


nativeStreamDescription

+ (MTCoreAudioStreamDescription *) nativeStreamDescription

Creates and returns a new MTCoreAudioStreamDescription configured for the canonical logical stream format (32-bit floating point, native endian, packed linear PCM, 1 frame per packet, interleaved), with zero channels and sample rate of zero Hz.


streamDescription

+ (MTCoreAudioStreamDescription *) streamDescription

Creates and returns a new, empty MTCoreAudioStreamDescription, with linear PCM format and all other attributes set to 0. Note that although any field set to 0 is supposed to be ignored, kMTCoreAudioStreamPhysicalSides may not like 0 attributes. Use matchStreamDescription:forSide: (MTCoreAudioStream) when constructing an MTCoreAudioDescription for use on kMTCoreAudioStreamPhysicalSides.


streamDescriptionWithAudioStreamBasicDescription:

+ (MTCoreAudioStreamDescription *) streamDescriptionWithAudioStreamBasicDescription:(AudioStreamBasicDescription)theDescription

Creates and returns an MTCoreAudioStreamDescription with its attributes taken directly from theDescription.


Instance Methods


audioStreamBasicDescription

- (AudioStreamBasicDescription) audioStreamBasicDescription

Returns an AudioStreamBasicDescription corresponding to the attributes of the instance.


bitsPerChannel

- (UInt32) bitsPerChannel

Gets the number of bits per channel. For kMTCoreAudioStreamLogicalSide, this is always 32.


bundleForDescriptionStrings

- (NSBundle *) bundleForDescriptionStrings

Returns the bundle containing the localized strings to use in constructing a textual description of the receiver. The default implementation returns the bundle in which class MTCoreAudioStreamDescription is defined. Subclasses may override this method to indicate that a different bundle contains a StreamDescription.strings file for use by description.


bytesPerFrame

- (UInt32) bytesPerFrame

Gets the number of bytes per frame. One frame represents one sample from each channel at one instant in time.


bytesPerPacket

- (UInt32) bytesPerPacket

Gets the number of bytes per packet. See CoreAudioTypes.h for more information.


channelsPerFrame

- (UInt32) channelsPerFrame

Gets the number of channels in one frame. A stream's audio data is a time-regular linear sequence of frames, where each frame consists of one sample from each channel in the stream at one instant in time.


description

- (NSString *) description

Returns a human-readable description of the attributes of the MTCoreAudioStreamDescription. When the format is "lpcm 32-bit floating-point big-endian packed", the "floating-point big-endian packed" part is not included.


formatFlags

- (UInt32) formatFlags

Gets the format flags. See CoreAudioTypes.h for more information.


formatID

- (UInt32) formatID

Returns the four-character-code identifying the audio data format. Usually 'lpcm' (kAudioFormatLinearPCM).


framesPerPacket

- (UInt32) framesPerPacket

Gets the number of frames per packet. See CoreAudioTypes.h for more information.


init

- (MTCoreAudioStreamDescription *) init

Initializes a newly allocated instance with linear PCM format and all other attributes 0. See class method streamDescription for more information.


initWithAudioStreamBasicDescription:

- (MTCoreAudioStreamDescription *) initWithAudioStreamBasicDescription:(AudioStreamBasicDescription)theDescription

Initializes a new instance with its attributes taken directly from theDescription.


isCanonicalFormat

- (Boolean) isCanonicalFormat

Returns YES if the receiver is in the canonical logical format (32-bit floating point, native endian, packed linear PCM, 1 frame per packet, interleaved or non-interleaved), and NO otherwise. Note that the native logical format is the interleaved canonical format.


isInterleaved

- (Boolean) isInterleaved

If the receiver's format is Linear PCM, returns YES if samples for multiple channels are interleaved in the same buffer, and NO if there is a separate buffer for each channel (de-interleaved). The result of this method is undefined if the format is not Linear PCM.


isLinearPCMFormat

- (Boolean) isLinearPCMFormat

Returns YES if the receiver's format is Linear Pulse Code Modulation (integer or floating point), and NO otherwise.


isNativeFormat

- (Boolean) isNativeFormat

Returns YES if the receiver is in the native logical format (32-bit floating point, native endian, packed linear PCM, 1 frame per packet, interleaved), and NO otherwise.


sampleRate

- (Float32) sampleRate

Returns the sample rate in Hertz. If the sample rate is 0.0 in an instance obtained from streamDescriptionsForChannel:forDirection: (MTCoreAudioDevice) or streamDescriptionsForSide: (MTCoreAudioStream) , that means any sample rate is supported. The device should always have a non-zero sample rate set.


setBitsPerChannel:

- (MTCoreAudioStreamDescription *) setBitsPerChannel:(UInt32)theBitsPerChannel

Sets the number of bits per channel. Returns the receiver.


setBytesPerFrame:

- (MTCoreAudioStreamDescription *) setBytesPerFrame:(UInt32)theBytesPerFrame

Sets the number of bytes per frame. One frame represents one sample from each channel at one instant in time. Returns the receiver.


setBytesPerPacket:

- (MTCoreAudioStreamDescription *) setBytesPerPacket:(UInt32)theBytesPerPacket

Sets the number of bytes per packet. See CoreAudioTypes.h for more information. Returns the receiver.


setChannelsPerFrame:

- (MTCoreAudioStreamDescription *) setChannelsPerFrame:(UInt32)theChannelsPerFrame

Sets the number of channels in one frame. A stream's audio data is a time-regular linear sequence of frames, where each frame consists of one sample from each channel in the stream at one instant in time. If the stream format is the canonical logical format, then the bytes per frame and bytes per packet are updated as well. Returns the receiver.


setFormatFlags:

- (MTCoreAudioStreamDescription *) setFormatFlags:

Sets the format flags. See CoreAudioTypes.h for more information. Returns the receiver.


setFormatID:

- (MTCoreAudioStreamDescription *) setFormatID:(UInt32)theFormatID

Sets the four-character-code identifying the audio data format. See formatID for more information. Returns the receiver.


setFramesPerPacket:

- (MTCoreAudioStreamDescription *) setFramesPerPacket:(UInt32)theFramesPerPacket

Sets the number of frames per packet. See CoreAudioTypes.h for more information. Returns the receiver.


setIsInterleaved:

- (MTCoreAudioStreamDescription *) setIsInterleaved:(Boolean)interleave

If the receiver's format is Linear PCM, sets whether samples for multiple channels are interleaved in the same buffer or kept in separate buffers (de-interleaved). If the stream format is the canonical logical format, then the bytes per frame and bytes per packet are updated as well. Has no effect if the format is not Linear PCM. Returns the receiver.


setNativeFormat

- (MTCoreAudioStreamDescription *) setNativeFormat

Sets the receiver to the canonical logical format (32-bit floating point, native endian, packed linear PCM, 1 frame per packet, interleaved). Sets the bytes per frame and bytes per packet based on the number of channels per frame. Returns the receiver.


setSampleRate:

- (MTCoreAudioStreamDescription *) setSampleRate:(Float32)theSampleRate;

Sets the sample rate. The device should always have a non-zero sample rate. Returns the receiver.



Mike > Mac OS X > MTCoreAudio.framework > MTCoreAudioStreamDescription