Class SurfaceMusicTrack
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
Adds a basic music track. Open in GitHub
[JsonObject(MemberSerialization.OptIn)]
public class SurfaceMusicTrack : IMusicTrack- Inheritance
- 
      
      SurfaceMusicTrack
- Implements
- Derived
- Inherited Members
- Extension Methods
Fields
Chance
[JsonProperty]
public float ChanceField Value
DistanceToSpawnPoint
[JsonProperty]
public float DistanceToSpawnPointField Value
Location
The location of the track.
[JsonProperty("File")]
public AssetLocation LocationField Value
MaxHour
Latest to play the track.
[JsonProperty]
public float MaxHourField Value
MaxLatitude
[JsonProperty]
public float MaxLatitudeField Value
MaxSeason
[JsonProperty]
public float MaxSeasonField Value
MaxTemperature
[JsonProperty]
public float MaxTemperatureField Value
MinHour
Earliest to play the track.
[JsonProperty]
public float MinHourField Value
MinLatitude
[JsonProperty]
public float MinLatitudeField Value
MinRainFall
[JsonProperty]
public float MinRainFallField Value
MinSeason
[JsonProperty]
public float MinSeasonField Value
MinSunlight
Minimum sunlight to play the track.
[JsonProperty]
public int MinSunlightField Value
OnPlayList
The current play style of the track
[JsonProperty]
public string OnPlayListField Value
OnPlayLists
public string[] OnPlayListsField Value
- string[]
ShouldPlayMusic
public static bool ShouldPlayMusicField Value
Sound
Get the current sound file.
public ILoadedSound SoundField Value
capi
Core client API.
protected ICoreClientAPI capiField Value
globalCooldownUntilMs
Global cooldown until next track
public static long globalCooldownUntilMsField Value
musicEngine
protected IMusicEngine musicEngineField Value
nowMaxHour
protected float nowMaxHourField Value
nowMinHour
protected float nowMinHourField Value
prevFrequency
Gets the previous frequency setting.
protected static int prevFrequencyField Value
tracksCooldownUntilMs
Cooldown for each track by name.
public static Dictionary<string, long> tracksCooldownUntilMsField Value
Properties
IsActive
Is the current song actively playing or is it loading? (False if neither action.
public bool IsActive { get; }Property Value
MusicFrequency
Gets the current Music Frequency setting.
public int MusicFrequency { 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. If higher than 1, will stop other tracks and start this one
[JsonProperty]
public float Priority { get; set; }Property Value
StartPriority
The start priority of the track. A higher priority will leave active tracks playing.
public float StartPriority { get; set; }Property Value
StartPriorityRnd
The songs starting priority. If higher than 1, then it will be started first. But does not interrupt already running tracks. When reading a songs start priority the maximum of start priority and priority is used
[JsonProperty("StartPriority")]
public NatFloat StartPriorityRnd { get; set; }Property Value
Methods
BeginPlay(TrackedPlayerProperties)
Begins playing the Music track.
public virtual void BeginPlay(TrackedPlayerProperties props)Parameters
- propsTrackedPlayerProperties
- 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
- dtfloat
- Delta Time/Change in time. 
- propsTrackedPlayerProperties
- 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
- secondsfloat
- The duration of the fade out in seconds. 
- onFadedOutAction
- What to have happen after the track has faded out. 
FastForward(float)
public virtual void FastForward(float seconds)Parameters
- secondsfloat
FrequencyChanged(int, ICoreClientAPI)
The Frequency change in the static system.
protected static void FrequencyChanged(int newFreq, ICoreClientAPI capi)Parameters
- newFreqint
- The new frequency 
- capiICoreClientAPI
- the core client API 
Initialize(IAssetManager, ICoreClientAPI, IMusicEngine)
Initialize the track.
public virtual void Initialize(IAssetManager assetManager, ICoreClientAPI capi, IMusicEngine musicEngine)Parameters
- assetManagerIAssetManager
- the global Asset Manager 
- capiICoreClientAPI
- The Core Client API 
- musicEngineIMusicEngine
SetCooldown(float)
Sets the cooldown of the current track.
public virtual void SetCooldown(float multiplier)Parameters
- multiplierfloat
- The multiplier for the cooldown. 
ShouldPlay(TrackedPlayerProperties, ClimateCondition, BlockPos)
Should this current track play?
public virtual bool ShouldPlay(TrackedPlayerProperties props, ClimateCondition conds, BlockPos pos)Parameters
- propsTrackedPlayerProperties
- Player Properties 
- condsClimateCondition
- posBlockPos
Returns
- bool
- Should we play the current track? 
UpdateVolume()
Updates the volume of the current track provided Sound is not null. (effectively calls Sound.SetVolume)
public virtual void UpdateVolume()selectMinMaxHour()
protected virtual void selectMinMaxHour()