Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    AudioEngine Class

    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.

    System.Object → DisposeBase → ComponentBase → AudioEngine
    Derived from AudioEngine:

    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.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    Methods


    Destroy()

    Destroys the instance.

    protected override void Destroy()
    Overrides
    ComponentBase.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
    Type Condition
    System.InvalidOperationException

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


    Inherited Members

    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation