Table of Contents

Interface ILoadedSound

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

Represents a loaded game sound

public interface ILoadedSound : IDisposable
Inherited Members

Properties

Channels

Amount of audio channels this sound has

int Channels { get; }

Property Value

int

HasStopped

Is the sound finished with playing? (false when only paused)

bool HasStopped { get; }

Property Value

bool

IsDisposed

Is the sound disposed of?

bool IsDisposed { get; }

Property Value

bool

IsFadingIn

True if the track is fading to a higher volume

bool IsFadingIn { get; }

Property Value

bool

IsFadingOut

True if the track is fading to a lower volume

bool IsFadingOut { get; }

Property Value

bool

IsPlaying

Is sound currently playing

bool IsPlaying { get; }

Property Value

bool

Params

The params the sound was created with.

SoundParams Params { get; }

Property Value

SoundParams

PlaybackPosition

Get the current playback position or set it (in seconds)

float PlaybackPosition { get; set; }

Property Value

float

SoundLengthSeconds

Length of the sound in seconds

float SoundLengthSeconds { get; }

Property Value

float

Methods

FadeIn(float, Action<ILoadedSound>)

Causes the sound to fade in

void FadeIn(float seconds, Action<ILoadedSound> onFadedIn)

Parameters

seconds float
onFadedIn Action<ILoadedSound>

Called when the fade in has completed. If in the meantime another FadeXXX call has been made, the method is not called

FadeOut(float, Action<ILoadedSound>)

Causes the sound to fade out

void FadeOut(float seconds, Action<ILoadedSound> onFadedOut)

Parameters

seconds float
onFadedOut Action<ILoadedSound>

Called when the fade out has completed. If in the meantime another FadeXXX call has been made, the method is not called

FadeOutAndStop(float)

Causes the sound to fade out and stop the track

void FadeOutAndStop(float seconds)

Parameters

seconds float

FadeTo(double, float, Action<ILoadedSound>)

Fades the sounds volumne to given value

void FadeTo(double newVolume, float duration, Action<ILoadedSound> onFaded)

Parameters

newVolume double
duration float
onFaded Action<ILoadedSound>

Called when the fade has completed. If in the meantime another FadeXXX call has been made, the method is not called

Pause()

Pauses the sound

void Pause()

SetLooping(bool)

void SetLooping(bool on)

Parameters

on bool

SetPitch(float)

Allows you to modify the pitch of the sound. May also be called while the sound is currently playing.

void SetPitch(float val)

Parameters

val float

SetPitchOffset(float)

Allows you to modify the pitch of the sound. May also be called while the sound is currently playing. This value is added together with the normal pitch level. This method is currently used to distort sound during low temporal stability

void SetPitchOffset(float val)

Parameters

val float

SetPosition(float, float, float)

void SetPosition(float x, float y, float z)

Parameters

x float
y float
z float

SetPosition(Vec3f)

Sets the position from where the sound is originating from

void SetPosition(Vec3f position)

Parameters

position Vec3f

SetVolume()

Sets the current volumne again. Use this to update the sounds volumne after the global sound level has changed

void SetVolume()

SetVolume(float)

Allows you to modify the volumne of the sound. May also be called while the sound is currently playing.

void SetVolume(float val)

Parameters

val float

Start()

Starts the sound

void Start()

Stop()

Stops the sound

void Stop()

Toggle(bool)

True for Starting, False for Stopping the sound

void Toggle(bool on)

Parameters

on bool