Class AudioEmitterSoundController
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
IsLooping
Gets or sets whether the sound is automatically looping from beginning when it reaches the end.
public bool IsLooping { get; set; }
Property Value
Pitch
public float Pitch { get; set; }
Property Value
PlayState
The current state of the sound.
public PlayState PlayState { get; }
Property Value
SpeedFactor
Set the play speed of the media
public float SpeedFactor { get; set; }
Property Value
Volume
The global volume at which the sound is played.
public float Volume { get; set; }
Property Value
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
PlayRangea 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