Table of Contents

Class AudioEmitterSoundController

Namespace
Stride.Audio
Assembly
Stride.Engine.dll

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

public class AudioEmitterSoundController : IPlayableSound, IMediaPlayer, IMediaReader
Inheritance
AudioEmitterSoundController
Implements

Remarks

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

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

  • The underlying Sound is disposed.
  • The AudioEmitterComponent is detached from its entity.
  • The entity to which it is attached is removed from the Entity System.

Properties

IsDisposed

Specifies if the extractor has been disposed

public bool IsDisposed { get; set; }

Property Value

bool

IsLooping

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

public bool IsLooping { get; set; }

Property Value

bool

Pitch

public float Pitch { get; set; }

Property Value

float

PlayState

The current state of the sound.

public PlayState PlayState { get; }

Property Value

PlayState

SpeedFactor

Set the play speed of the media

public float SpeedFactor { get; set; }

Property Value

float

Volume

The global volume at which the sound is played.

public float Volume { get; set; }

Property Value

float

Remarks

Volume is ranging from 0.0f (silence) to 1.0f (full volume). Values beyond those limits are clamped.

Methods

Pause()

Pause the sounds.

public void Pause()

Remarks

A call to Pause when the sound is already paused or stopped has no effects.

Play()

Start or resume playing the sound.

public void Play()

Remarks

A call to Play when the sound is already playing has no effects.

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)

Seek to provided position in the media source.

public void Seek(TimeSpan mediaTime)

Parameters

mediaTime TimeSpan

SetRange(PlayRange)

Sets the range of the sound to play.

public void SetRange(PlayRange range)

Parameters

range PlayRange

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()

Stop playing the sound immediately and reset the sound to the beginning of the track.

public void Stop()

Remarks

A call to Stop when the sound is already stopped has no effects