Api Sandbox MusicPlayer
class

MusicPlayer

public sealed class MusicPlayer

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

Properties

Name Type Description
SampleRate Int32 Sample rate of the audio being played.
Channels Int32 Number of channels of the audio being played.
Duration Single Gets the total duration of the video in seconds.
PlaybackTime Single Gets the current playback time in seconds.
OnFinished Action Invoked when the audio has finished playing.
OnRepeated Action Invoked when the audio has repeated.
ListenLocal Boolean Place the listener at 0,0,0 facing 1,0,0.
Position Vector3 Position of the sound.
Paused Boolean Pause playback of audio.
Repeat Boolean Audio will repeat when reaching the end.
Volume Single Change the volume of this music.
LipSync Boolean Enables lipsync processing.
TargetMixer Mixer Which mixer do we want to write to
Distance Single
Falloff Curve
Visemes IReadOnlyList<Single> A list of 15 lipsync viseme weights. Requires LipSync to be enabled.
Title String Get title of the track.
Spectrum ReadOnlySpan<Single> 512 FFT magnitudes used for audio visualization.
Amplitude Single Approximate measure of audio loudness.

Methods

virtual Void Dispose()
static MusicPlayer PlayUrl(String url)

Plays a music stream from a URL.

static MusicPlayer Play(BaseFileSystem filesystem, String path)

Plays a music file from a relative path.

Void Stop()

Stops audio playback.

Void Seek(Single time)

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

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.MusicPlayer