Velaptor.Content.Sound
Velaptor
Velaptor.Content
Sound Class
A single sound that can be played, paused etc.
public sealed class Sound :
Velaptor.Content.ISound,
CASL.ISound,
System.IDisposable,
Velaptor.Content.IContent
Inheritance System.Object → Sound
Implements ISound, CASL.ISound, System.IDisposable, IContent
Constructors
Sound(string) Constructor
Initializes a new instance of the Sound class.
public Sound(string filePath);
Parameters
filePath
System.String
The path to the sound file.
Properties
FilePath
Gets the fully qualified path to the sound file.
public string FilePath { get; }
Implements FilePath, FilePath, FilePath
Property Value
Id
Gets the unique ID of the sound.
public uint Id { get; set; }
Implements Id
Property Value
IsLooping
Gets or sets a value indicating whether or not the sound loops back to the beginning once the end has been reached.
public bool IsLooping { get; set; }
Implements IsLooping
Property Value
Length
Gets the length of the sound.
public CASL.SoundTime Length { get; }
Implements Length
Property Value
Name
Gets the name of the sound.
public string Name { get; }
Property Value
PlaySpeed
Gets or sets the play speed to the given value.
public float PlaySpeed { get; set; }
Implements PlaySpeed
Property Value
Remarks
The valid range of value is between 0.25 and 2.0
with a value less than 0.25 defaulting to 0.25 and
with a value greater than 2.0 defaulting to 2.0.
Position
Gets the current time position of the sound.
public CASL.SoundTime Position { get; }
Implements Position
Property Value
State
Gets the state of the sound.
public CASL.SoundState State { get; }
Implements State
Property Value
Volume
Gets or sets the volume of the sound.
public float Volume { get; set; }
Implements Volume
Property Value
Remarks
The only valid value accepted is 0-100. If a value outside of
this range is used, it will be set within that range.
Methods
Dispose()
public void Dispose();
Implements Dispose()
FastForward(float)
Advances the sound forward by the given amount of seconds.
public void FastForward(float seconds);
Parameters
seconds
System.Single
The amount of seconds to fast forward the sound.
Implements FastForward(float)
Pause()
Pauses the sound.
public void Pause();
Implements Pause()
Play()
Plays the sound.
public void Play();
Implements Play()
Reset()
Resets the sound.
public void Reset();
Implements Reset()
Remarks
This will stop the sound and set the time position back to the beginning.
Rewind(float)
Rewinds the sound by the given amount of seconds.
public void Rewind(float seconds);
Parameters
seconds
System.Single
The amount of seconds to rewind the sound.
Implements Rewind(float)
SetTimePosition(float)
Sets the time position of the sound to the given value.
public void SetTimePosition(float seconds);
Parameters
seconds
System.Single
The time position in seconds of where to set the sound.
Implements SetTimePosition(float)
Stop()
Stops the sound.
public void Stop();
Implements Stop()
Remarks
This will set the time position back to the beginning.