Contents

spatialAudioChannelLayoutTag

The audio channel layout tag of the audio sample buffers produced by the audio data output.

Declaration

var spatialAudioChannelLayoutTag: AudioChannelLayoutTag { get set }

Discussion

When you set your audio data output’s associated multichannelAudioMode property to AVCaptureMultichannelAudioModeFirstOrderAmbisonics, the AVCaptureSession allows up to two AVCaptureAudioDataOutput instances to be connected to the First-order Ambisonsics (FOA) input. If you connect a single AVCaptureAudioDataOutput instance, you must configure its spatialAudioChannelLayoutTag property to produce either four channels of FOA audio or two channels of Stereo audio. If you connect two AVCaptureAudioDataOutput instances, you must configure one to output four channels of FOA audio and the other to output two channels of Stereo audio.

Thus, when you set your associated multichannelAudioMode property to AVCaptureMultichannelAudioModeFirstOrderAmbisonics, you must set your connected AVCaptureAudioDataOutput instance’s spatialAudioChannelLayoutTag property to either kAudioChannelLayoutTag_Stereo for stereo, or (kAudioChannelLayoutTag_HOA_ACN_SN3D | 4) for FOA (see AudioChannelLayoutTag). When you set your associated multichannelAudioMode to any other value, the AVCaptureSession only supports one AVCaptureAudioDataOutput, and you may only set spatialAudioChannelLayoutTag to kAudioChannelLayoutTag_Unknown (the default value).

Your AVCaptureSession validates your app’s adherence to the the above rules when you call AVCaptureSession/startRunning: or commitConfiguration() and throws a NSInvalidArgumentException if necessary.

See Also

Configuring audio capture