AudioGraph Class

Definition

Represents an audio graph of connected input, output, and submix nodes that manipulate and route audio.

public ref class AudioGraph sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class AudioGraph final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class AudioGraph : System.IDisposable
Public NotInheritable Class AudioGraph
Implements IDisposable
Inheritance
Object Platform::Object IInspectable AudioGraph
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
backgroundMediaRecording

Remarks

The audio graph is made up of input nodes, output nodes, and submix nodes. Input nodes include audio files, audio devices, and code that generates audio data. Output nodes also include audio files, audio devices, and code that processes audio data. When the graph is started, audio data flows through the graph from the input nodes, through any submix nodes, to the output nodes. Each node can have zero or more audio effects that are applied to the audio data before it is passed to the next node. This class and related APIs enable you to develop audio applications more quickly and easily than the low-level COM XAudio2 APIs. For how-to guidance on using audio graphs, see Audio graphs.

Get an instance of this class by calling AudioGraph.CreateAsync.

The entire audio graph must operate at the same sample rate. Sources can have different sample rates, but are resampled immediately.

Note

If no audio devices are available, the audio graph cannot be instantiated.

AudioGraph cannot be instantiated on the N and KN editions of Windows 8 and Windows 10, unless the optional Media Feature Pack has been installed. For more information, see Media Feature Pack for Windows N editions.

Version history

Windows version SDK version Value added
1607 14393 CreateBatchUpdater
1607 14393 CreateDeviceInputNodeAsync(MediaCategory,AudioEncodingProperties,DeviceInformation,AudioNodeEmitter)
1607 14393 CreateFileInputNodeAsync(IStorageFile,AudioNodeEmitter)
1607 14393 CreateFrameInputNode(AudioEncodingProperties,AudioNodeEmitter)
1607 14393 CreateSubmixNode(AudioEncodingProperties,AudioNodeEmitter)
1803 17134 CreateMediaSourceAudioInputNodeAsync(MediaSource)
1803 17134 CreateMediaSourceAudioInputNodeAsync(MediaSource,AudioNodeEmitter)

Properties

CompletedQuantumCount

Gets the completed quantum count for the audio graph.

EncodingProperties

Gets the encoding properties for the audio graph.

LatencyInSamples

Gets the latency in samples that the audio graph supports.

PrimaryRenderDevice

Gets the primary render device for the audio graph.

RenderDeviceAudioProcessing

Gets a value that indicates the audio processing mode for the audio graph.

SamplesPerQuantum

Gets the number of samples per quantum at which the audio graph is currently operating.

Methods

Close()

Closes the audio graph and disposes of associated resources.

CreateAsync(AudioGraphSettings)

Creates an audio graph with specific settings.

CreateBatchUpdater()

Creates a new AudioGraphBatchUpdater for the AudioGraph which causes all subsequent modifications to all nodes in the audio graph to be accumulated and then committed once your app closes or disposes of the batch updater object.

CreateDeviceInputNodeAsync(MediaCategory)

Creates an AudioDeviceInputNode that inputs audio data into the audio graph from the default audio input device, such as a microphone or audio card.

CreateDeviceInputNodeAsync(MediaCategory, AudioEncodingProperties)

Creates an AudioDeviceInputNode that inputs audio data into the audio graph from the default audio input device such as a microphone or audio card.

CreateDeviceInputNodeAsync(MediaCategory, AudioEncodingProperties, DeviceInformation)

Creates an AudioDeviceInputNode that inputs audio data into the audio graph from the specified audio input device such as a microphone or audio card.

CreateDeviceInputNodeAsync(MediaCategory, AudioEncodingProperties, DeviceInformation, AudioNodeEmitter)

Creates a spatial audio-enabled AudioDeviceInputNode that inputs audio data into the audio graph from the specified audio input device such as a microphone or audio card.

CreateDeviceOutputNodeAsync()

Creates a new AudioDeviceOutputNode that outputs audio data from the audio graph to the system's default output device, such as speakers or headphones.

CreateFileInputNodeAsync(IStorageFile)

Creates an AudioFileInputNode that inputs audio data into the audio graph from a storage file.

CreateFileInputNodeAsync(IStorageFile, AudioNodeEmitter)

Creates a spatial audio-enabled AudioFileInputNode that inputs audio data into the audio graph from a storage file.

CreateFileOutputNodeAsync(IStorageFile)

Creates a new AudioFileOutputNode that outputs audio data from the audio graph to the specified storage file.

CreateFileOutputNodeAsync(IStorageFile, MediaEncodingProfile)

Creates a new AudioFileOutuputNode that outputs audio data from the audio graph to the specified storage file.

CreateFrameInputNode()

Creates an AudioFrameInputNode that inputs audio data generated by app-implemented code into the audio graph.

CreateFrameInputNode(AudioEncodingProperties)

Creates an AudioFrameInputNode, with the specified encoding properties, that inputs audio data generated by app-implemented code into the audio graph.

CreateFrameInputNode(AudioEncodingProperties, AudioNodeEmitter)

Creates a spatial audio-enabled AudioFrameInputNode, with the specified encoding properties, that inputs audio data generated by app-implemented code into the audio graph.

CreateFrameOutputNode()

Creates a new AudioFrameOutputNode that outputs audio data from the audio graph to app-implemented code.

CreateFrameOutputNode(AudioEncodingProperties)

Creates a new AudioFrameOutputNode, with the specified encoding properties, that outputs audio data from the audio graph to app-implemented code.

CreateMediaSourceAudioInputNodeAsync(MediaSource)

Creates a MediaSourceAudioInputNode that inputs audio data into the audio graph from the provided MediaSource object.

CreateMediaSourceAudioInputNodeAsync(MediaSource, AudioNodeEmitter)

Creates a spatial audio-enabled MediaSourceAudioInputNode that inputs audio data into the audio graph from the provided MediaSource object.

CreateSubmixNode()

Creates an AudioSubmixNode that mixes the output of one or more audio graph nodes into a single output that can be connected to output nodes or other submix nodes.

CreateSubmixNode(AudioEncodingProperties)

Creates an AudioSubmixNode that mixes the output of one or more audio graph nodes into a single output that can be connected to output nodes or other submix nodes.

CreateSubmixNode(AudioEncodingProperties, AudioNodeEmitter)

Creates a spatial audio-enabled AudioSubmixNode that mixes the output of one or more audio graph nodes into a single output that can be connected to output nodes or other submix nodes.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ResetAllNodes()

Resets all nodes in the audio graph.

Start()

Starts the audio graph.

Stop()

Stops the audio graph.

Events

QuantumProcessed

Notifies that the audio graph has processed the specified quantum.

QuantumStarted

Notifies that the audio graph has started processing a new quantum.

UnrecoverableErrorOccurred

Notifies of an unrecoverable audio error in audio graph operation.

Applies to

See also