Table of Contents

Class MusicTrack

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

Adds a basic music track.

public class MusicTrack : IMusicTrack
Inheritance
MusicTrack
Implements
Inherited Members
Extension Methods

Fields

Location

public AssetLocation Location

Field Value

AssetLocation

ManualDispose

public bool ManualDispose

Field Value

bool

Sound

Get the current sound file.

public ILoadedSound Sound

Field Value

ILoadedSound

loading

Is it loading?

public bool loading

Field Value

bool

Properties

IsActive

Is the current song actively playing or is it loading? (False if neither action.

public bool IsActive { get; }

Property Value

bool

Name

The name of the track.

public string Name { get; }

Property Value

string

PositionString

public string PositionString { get; }

Property Value

string

Priority

The current song's priority.

public float Priority { get; set; }

Property Value

float

StartPriority

The start priority of the track. A higher priority will leave active tracks playing.

public virtual float StartPriority { get; }

Property Value

float

Methods

BeginPlay(TrackedPlayerProperties)

Begins playing the Music track.

public virtual void BeginPlay(TrackedPlayerProperties props)

Parameters

props TrackedPlayerProperties

Player Properties

BeginSort()

Called before sorting by start priority happens

public virtual void BeginSort()

ContinuePlay(float, TrackedPlayerProperties)

Is it cool for the current track to continue playing?

public virtual bool ContinuePlay(float dt, TrackedPlayerProperties props)

Parameters

dt float

Delta Time/Change in time.

props TrackedPlayerProperties

Track properties.

Returns

bool

Cool or not cool?

FadeOut(float, Action)

Fades out the current track.

public virtual void FadeOut(float seconds, Action onFadedOut = null)

Parameters

seconds float

The duration of the fade out in seconds.

onFadedOut Action

What to have happen after the track has faded out.

FastForward(float)

public void FastForward(float seconds)

Parameters

seconds float

Initialize(IAssetManager, ICoreClientAPI, IMusicEngine)

Initialize the track.

public virtual void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine)

Parameters

assetManager IAssetManager

the global Asset Manager

capi ICoreClientAPI

The Core Client API

musicEngine IMusicEngine

ShouldPlay(TrackedPlayerProperties, ClimateCondition, BlockPos)

Should this current track play?

public virtual bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos)

Parameters

props TrackedPlayerProperties

Player Properties

conds ClimateCondition
pos BlockPos

Returns

bool

Should we play the current track?

Stop()

Stops the track immediately

public void Stop()

UpdateVolume()

Updates the volume of the current track provided Sound is not null. (effectively calls Sound.SetVolume)

public virtual void UpdateVolume()