Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    AudioEmitterSoundController Class

    Namespace: Stride.Audio
    Assembly: Stride.Engine.dll

    This class is used to control a SoundBase associated to a AudioEmitterComponent.

    System.Object → AudioEmitterSoundController
    Derived from AudioEmitterSoundController:

    public class AudioEmitterSoundController : IPlayableSound, IMediaPlayer, IMediaReader
    Remarks

    Instances of this class can not be directly created by the user, but need to queried from an AudioEmitterComponent instance using the readonly indexer.

    An instance AudioEmitterSoundController is not valid anymore if any of those situations arrives:

    • The underlying Stride.Audio.AudioEmitterSoundController.sound is disposed.
    • The AudioEmitterComponent is detached from its entity.
    • The entity to which it is attached is removed from the Entity System.

    Name Description
    Properties
    IsDisposed
    IsLooping

    Gets or sets whether the sound is automatically looping from beginning when it reaches the end.

    Pitch
    PlayState
    SpeedFactor
    Volume
    Methods
    Pause()
    Play()
    PlayAndForget()

    Plays the attached sound in a new instance and let's the engine handle it's disposal. This is useful for very fast overlapping sounds, gun shots, machine gun etc. Where you don't care about controlling each sound.

    Seek(TimeSpan)
    SetRange(PlayRange)

    Sets the range of the sound to play.

    Stop()
    | Improve this Doc View Source

    Properties


    IsDisposed

    public bool IsDisposed { get; set; }
    Property Value
    Type Description
    System.Boolean

    IsLooping

    Gets or sets whether the sound is automatically looping from beginning when it reaches the end.

    public bool IsLooping { get; set; }
    Property Value
    Type Description
    System.Boolean

    Pitch

    public float Pitch { get; set; }
    Property Value
    Type Description
    System.Single

    PlayState

    public PlayState PlayState { get; }
    Property Value
    Type Description
    PlayState

    SpeedFactor

    public float SpeedFactor { get; set; }
    Property Value
    Type Description
    System.Single

    Volume

    public float Volume { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Methods


    Pause()

    public void Pause()

    Play()

    public void Play()

    PlayAndForget()

    Plays the attached sound in a new instance and let's the engine handle it's disposal. This is useful for very fast overlapping sounds, gun shots, machine gun etc. Where you don't care about controlling each sound.

    public void PlayAndForget()

    Seek(TimeSpan)

    public void Seek(TimeSpan mediaTime)
    Parameters
    Type Name Description
    System.TimeSpan mediaTime

    SetRange(PlayRange)

    Sets the range of the sound to play.

    public void SetRange(PlayRange range)
    Parameters
    Type Name Description
    PlayRange range

    a PlayRange structure that describes the starting offset and ending point of the sound to play in seconds.

    Remarks

    This will not be valid if the sound is played with PlayAndForget


    Stop()

    public void Stop()

    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