MusicPlayerclass

Enables music playback. Use this for music, not for playing game sounds.

objectMusicPlayer
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.MusicPlayer

Methods5

Showing 5 methods

public virtual sealed void Dispose()PUBLICVIRTUAL

Returns:void

public static Sandbox.MusicPlayer PlayUrl(string url)PUBLICSTATIC

Plays a music stream from a URL.

ParameterTypeDescription
urlstring
Returns:MusicPlayer

public void Seek(float time)PUBLIC

Sets the playback position to a specified time in the audio, given in seconds.

ParameterTypeDescription
timefloat
Returns:void

public void Stop()PUBLIC

Stops audio playback.

Returns:void

Properties19

Showing 19 properties

public float Sandbox.MusicPlayer.Amplitude { get; set; }PUBLICGETSET

Approximate measure of audio loudness.

Returns:float

public int Sandbox.MusicPlayer.Channels { get; set; }PUBLICGETSET

Number of channels of the audio being played.

Returns:int

public float Sandbox.MusicPlayer.Distance { get; set; }PUBLICGETSET

Returns:float

public float Sandbox.MusicPlayer.Duration { get; set; }PUBLICGETSET

Gets the total duration of the video in seconds.

Returns:float

public bool Sandbox.MusicPlayer.LipSync { get; set; }PUBLICGETSET

Enables lipsync processing.

Returns:bool

public bool Sandbox.MusicPlayer.ListenLocal { get; set; }PUBLICGETSET

Place the listener at 0,0,0 facing 1,0,0.

Returns:bool

public System.Action Sandbox.MusicPlayer.OnFinished { get; set; }PUBLICGETSET

Invoked when the audio has finished playing.

Returns:Action

public System.Action Sandbox.MusicPlayer.OnRepeated { get; set; }PUBLICGETSET

Invoked when the audio has repeated.

Returns:Action

public bool Sandbox.MusicPlayer.Paused { get; set; }PUBLICGETSET

Pause playback of audio.

Returns:bool

public float Sandbox.MusicPlayer.PlaybackTime { get; set; }PUBLICGETSET

Gets the current playback time in seconds.

Returns:float

public bool Sandbox.MusicPlayer.Repeat { get; set; }PUBLICGETSET

Audio will repeat when reaching the end.

Returns:bool

public int Sandbox.MusicPlayer.SampleRate { get; set; }PUBLICGETSET

Sample rate of the audio being played.

Returns:int

public System.ReadOnlySpan`1<float> Sandbox.MusicPlayer.Spectrum { get; set; }PUBLICGETSET

512 FFT magnitudes used for audio visualization.

Returns:ReadOnlySpan<float>

public Sandbox.Audio.Mixer Sandbox.MusicPlayer.TargetMixer { get; set; }PUBLICGETSET

Which mixer do we want to write to

Returns:Mixer

public string Sandbox.MusicPlayer.Title { get; set; }PUBLICGETSET

Get title of the track.

Returns:string

public System.Collections.Generic.IReadOnlyList`1<float> Sandbox.MusicPlayer.Visemes { get; set; }PUBLICGETSET

A list of 15 lipsync viseme weights. Requires `Sandbox.MusicPlayer.LipSync` to be enabled.

Returns:IReadOnlyList<float>

public float Sandbox.MusicPlayer.Volume { get; set; }PUBLICGETSET

Change the volume of this music.

Returns:float

On this page

Methodspublic virtual sealed System.Void Dispose()public static Sandbox.MusicPlayer Play(Sandbox.BaseFileSystem filesystem, System.String path)public static Sandbox.MusicPlayer PlayUrl(System.String url)public System.Void Seek(System.Single time)public System.Void Stop()Propertiespublic System.Single Sandbox.MusicPlayer.Amplitude { get; set; }public System.Int32 Sandbox.MusicPlayer.Channels { get; set; }public System.Single Sandbox.MusicPlayer.Distance { get; set; }public System.Single Sandbox.MusicPlayer.Duration { get; set; }public Sandbox.Curve Sandbox.MusicPlayer.Falloff { get; set; }public System.Boolean Sandbox.MusicPlayer.LipSync { get; set; }public System.Boolean Sandbox.MusicPlayer.ListenLocal { get; set; }public System.Action Sandbox.MusicPlayer.OnFinished { get; set; }public System.Action Sandbox.MusicPlayer.OnRepeated { get; set; }public System.Boolean Sandbox.MusicPlayer.Paused { get; set; }public System.Single Sandbox.MusicPlayer.PlaybackTime { get; set; }public Vector3 Sandbox.MusicPlayer.Position { get; set; }public System.Boolean Sandbox.MusicPlayer.Repeat { get; set; }public System.Int32 Sandbox.MusicPlayer.SampleRate { get; set; }public System.ReadOnlySpan`1<System.Single> Sandbox.MusicPlayer.Spectrum { get; set; }public Sandbox.Audio.Mixer Sandbox.MusicPlayer.TargetMixer { get; set; }public System.String Sandbox.MusicPlayer.Title { get; set; }public System.Collections.Generic.IReadOnlyList`1<System.Single> Sandbox.MusicPlayer.Visemes { get; set; }public System.Single Sandbox.MusicPlayer.Volume { get; set; }Metadata