AudioEngine Class
Namespace: Stride.AudioAssembly: 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
Name | Description | |
---|---|---|
Constructors | ||
AudioEngine(AudioDevice, UInt32) | Initializes a new instance of the AudioEngine class with the default audio device. |
|
AudioEngine(UInt32) | Initializes a new instance of the AudioEngine class with the default audio device. |
|
Fields | ||
DefaultListener | ||
Logger | The logger of the audio engine. |
|
Properties | ||
MasterVolume | Gets or sets the Global audio volume |
|
State | The current state of the AudioEngine. |
|
Methods | ||
Destroy() | Destroys the instance. |
|
PauseAudio() | Pause the audio engine. That is, pause all the currently playing SoundInstance, and block any future play until ResumeAudio() is called. |
|
ResumeAudio() | Resume all audio engine. That is, resume the sounds paused by PauseAudio(), and re-authorize future calls to play. |
|
Update() | Method that updates all the sounds play status. |
Constructors
AudioEngine(AudioDevice, UInt32)
Initializes a new instance of the AudioEngine class with the default audio device.
public AudioEngine(AudioDevice device, uint sampleRate = 0U)
Parameters
Type | Name | Description |
---|---|---|
AudioDevice | device | Device on which to create the audio engine. |
System.UInt32 | sampleRate | The desired sample rate of the audio graph. 0 let the engine choose the best value depending on the hardware. |
Exceptions
Type | Condition |
---|---|
AudioInitializationException | Initialization of the audio engine failed. May be due to memory problems or missing audio hardware. |
AudioEngine(UInt32)
Initializes a new instance of the AudioEngine class with the default audio device.
public AudioEngine(uint sampleRate = 0U)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | sampleRate | The desired sample rate of the audio graph. 0 let the engine choose the best value depending on the hardware. |
Exceptions
Type | Condition |
---|---|
AudioInitializationException | Initialization of the audio engine failed. May be due to memory problems or missing audio hardware. |
Fields
DefaultListener
public AudioListener DefaultListener
Field Value
Type | Description |
---|---|
AudioListener |
Logger
The logger of the audio engine.
public static readonly Logger Logger
Field Value
Type | Description |
---|---|
Logger |
Properties
MasterVolume
Gets or sets the Global audio volume
public float MasterVolume { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
State
The current state of the AudioEngine.
public AudioEngineState State { get; protected set; }
Property Value
Type | Description |
---|---|
AudioEngineState |
Methods
Destroy()
Destroys the instance.
protected override void Destroy()
Overrides
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
Type | Condition |
---|---|
System.InvalidOperationException | One or several of the sounds asked for play had invalid data (corrupted or unsupported formats). |