Upravit

Sdílet prostřednictvím


AudioStreamBasicDescription Struct

Definition

Audio packet stream description.

public struct AudioStreamBasicDescription
type AudioStreamBasicDescription = struct
Inheritance
AudioStreamBasicDescription

Remarks

The audio stack processes audio as a stream of audio packets. This data structure is used to describe the contents of these audio packets and contains information like the sample rate used for the audio samples, the format of the individual audio packets, the number of channels in the packets and the bits per channel, and so on.

This structure is filled in with the information when reading or decoding data. When you generate data, you should populate the structure with the proper values.


// 
// Standard pattern
//
int channels = 1;

sampleRate = AudioSession.CurrentHardwareSampleRate;
var format = new AudioStreamBasicDescription () {
        SampleRate = sampleRate,
        Format = AudioFormatType.LinearPCM,
        FormatFlags = AudioFormatFlags.LinearPCMIsSignedInteger | AudioFormatFlags.LinearPCMIsPacked,
        BitsPerChannel = 16,
        ChannelsPerFrame = channels
        BytesPerFrame = 2 * (interleaved ? channels : 1),
        BytesPerPacket = 2,
        FramesPerPacket = 1,
};

//
// Convenience Function for LinearPCM configurations
//
var format2 = AudioStreamBasicDescription.CreateLinearPCM (sampleRate, channelsperFrame, bitsPerChannel, bigEndian);

Constructors

AudioStreamBasicDescription(AudioFormatType)

Initializes the AudioStreamBasicDescription with the specified format type.

Fields

AudioFormatFlagsAudioUnitCanonical

Developers should not use this deprecated field. Canonical is no longer encouraged, since fixed-point no longer provides a performance advantage over floating point. 'AudioFormatFlagsNativeFloatPacked' is preffered instead.

AudioFormatFlagsAudioUnitNativeFloat
AudioFormatFlagsNativeFloat
AudioStreamAnyRate

Flag used to indicate that the audio stream can use any rate (can be assigned to the SampleRate field)

BitsPerChannel

Number of bits for an audio sample, per channel; Use zero for compressed formats.

BytesPerFrame

Number of bytes in an audio frame; Use Zero for compressed formats.

BytesPerPacket
ChannelsPerFrame

Number of audio channels.

Format

Audio format type.

FormatFlags

Audio format specific flags.

FramesPerPacket

Number of frames per audio packet.

Reserved

Unused, must be zero.

SampleRate

The sample rate for the audio data.

Properties

FormatName
IsEncrypted
IsExternallyFramed
IsVariableBitrate

Methods

CreateLinearPCM(Double, UInt32, UInt32, Boolean)

Convenience function to create an AudioStreamBasicDescription for LinearPCM data..

GetAvailableEncodeChannelLayoutTags(AudioStreamBasicDescription)
GetAvailableEncodeNumberChannels(AudioStreamBasicDescription)
GetFormatInfo(AudioStreamBasicDescription)
GetFormatList(Byte[])
GetOutputFormatList(Byte[])
ToString()

Renders a debugging-friendly description of the contents of the AudioStreamBasicDescription.

Applies to