Initializer

init(streamDescription:channelLayout:)

Initializes a newly allocated audio format instance from a stream description and channel layout.

Declaration

init?(streamDescription asbd: UnsafePointer<AudioStreamBasicDescription>, channelLayout layout: AVAudioChannelLayout?)

Parameters

asbd
layout

The channel layout. If nil, and asbd specifies 1 or 2 channels, mono or stereo layout is assumed, respectively.

Return Value

An initialized AVAudioFormat instance, or nil if the initialization fails.

Discussion

If the AudioStreamBasicDescription specifies more than 2 channels and layout is nil, this method fails and returns nil.

See Also

Creating a New Audio Format Representation

init(standardFormatWithSampleRate: Double, channelLayout: AVAudioChannelLayout)

Initializes a newly allocated audio format instance as a deinterleaved float with the specified sample rate and channel layout.

init?(standardFormatWithSampleRate: Double, channels: AVAudioChannelCount)

Initializes a newly allocated audio format instance with the specified sample rate and channel count.

init(commonFormat: AVAudioCommonFormat, sampleRate: Double, interleaved: Bool, channelLayout: AVAudioChannelLayout)

Initializes a newly allocated audio format instance with the specified auto format, sample rate, interleaved format and channel layout.

init?(settings: [String : Any])

Initializes a newly allocated audio format instance using a settings dictionary.

init?(streamDescription: UnsafePointer<AudioStreamBasicDescription>)

Initializes a newly allocated audio format instance from a stream description.

init(cmAudioFormatDescription: CMAudioFormatDescription)

Initializes a newly allocated audio format instance from a Core Media audio format description.