Table of Contents

Class AudioEngine

Namespace
Stride.Audio
Assembly
Stride.Audio.dll

Represents the audio engine. In current version, the audio engine necessarily creates its context on the default audio hardware of the device. The audio engine is required when creating or loading sounds.

public class AudioEngine : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
AudioEngine
Implements
Inherited Members
Extension Methods

Remarks

The AudioEngine is Disposable. Call the Dispose() function when you do not need to play sounds anymore to free memory allocated to the audio system. A call to Dispose automatically stops and disposes all the SoundBase, SoundInstance.

Constructors

AudioEngine(AudioDevice, uint)

Initializes a new instance of the AudioEngine class with the default audio device.

public AudioEngine(AudioDevice device, uint sampleRate = 0)

Parameters

device AudioDevice

Device on which to create the audio engine.

sampleRate uint

The desired sample rate of the audio graph. 0 let the engine choose the best value depending on the hardware.

Exceptions

AudioInitializationException

Initialization of the audio engine failed. May be due to memory problems or missing audio hardware.

AudioEngine(uint)

Initializes a new instance of the AudioEngine class with the default audio device.

public AudioEngine(uint sampleRate = 0)

Parameters

sampleRate uint

The desired sample rate of the audio graph. 0 let the engine choose the best value depending on the hardware.

Exceptions

AudioInitializationException

Initialization of the audio engine failed. May be due to memory problems or missing audio hardware.

Fields

DefaultListener

public AudioListener DefaultListener

Field Value

AudioListener

Logger

The logger of the audio engine.

public static readonly Logger Logger

Field Value

Logger

Properties

MasterVolume

Gets or sets the Global audio volume

public float MasterVolume { get; set; }

Property Value

float

State

The current state of the AudioEngine.

public AudioEngineState State { get; protected set; }

Property Value

AudioEngineState

Methods

Destroy()

Destroys the instance.

protected override void Destroy()

PauseAudio()

Pause the audio engine. That is, pause all the currently playing SoundInstance, and block any future play until ResumeAudio() is called.

public void PauseAudio()

ResumeAudio()

Resume all audio engine. That is, resume the sounds paused by PauseAudio(), and re-authorize future calls to play.

public void ResumeAudio()

Update()

Method that updates all the sounds play status.

public void Update()

Remarks

Should be called in same thread as user main thread.

Exceptions

InvalidOperationException

One or several of the sounds asked for play had invalid data (corrupted or unsupported formats).