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
ManualDispose
public bool ManualDispose
Field Value
Sound
Get the current sound file.
public ILoadedSound Sound
Field Value
loading
Is it loading?
public bool loading
Field Value
Properties
IsActive
Is the current song actively playing or is it loading? (False if neither action.
public bool IsActive { get; }
Property Value
Name
The name of the track.
public string Name { get; }
Property Value
PositionString
public string PositionString { get; }
Property Value
Priority
The current song's priority.
public float Priority { get; set; }
Property Value
StartPriority
The start priority of the track. A higher priority will leave active tracks playing.
public virtual float StartPriority { get; }
Property Value
Methods
BeginPlay(TrackedPlayerProperties)
Begins playing the Music track.
public virtual void BeginPlay(TrackedPlayerProperties props)
Parameters
props
TrackedPlayerPropertiesPlayer 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
floatDelta Time/Change in time.
props
TrackedPlayerPropertiesTrack 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
floatThe duration of the fade out in seconds.
onFadedOut
ActionWhat 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
IAssetManagerthe global Asset Manager
capi
ICoreClientAPIThe 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
TrackedPlayerPropertiesPlayer Properties
conds
ClimateConditionpos
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()