AudioEmitterSoundController Class
Namespace: Stride.AudioAssembly: Stride.Engine.dll
This class is used to control a SoundBase associated to a AudioEmitterComponent.
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
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() |
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 |
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()