Skip to main content
Version: 1.0.0-preview.33

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

System.String

Id

Gets the unique ID of the sound.

public uint Id { get; set; }

Implements Id

Property Value

System.UInt32

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

System.Boolean

Length

Gets the length of the sound.

public CASL.SoundTime Length { get; }

Implements Length

Property Value

CASL.SoundTime

Name

Gets the name of the sound.

public string Name { get; }

Implements Name, Name, Name

Property Value

System.String

PlaySpeed

Gets or sets the play speed to the given value.

public float PlaySpeed { get; set; }

Implements PlaySpeed

Property Value

System.Single

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

CASL.SoundTime

State

Gets the state of the sound.

public CASL.SoundState State { get; }

Implements State

Property Value

CASL.SoundState

Volume

Gets or sets the volume of the sound.

public float Volume { get; set; }

Implements Volume

Property Value

System.Single

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.