Plush

SequencePlayback#

PlushEngine · Type index

Namespace: PlushEngine.Audio (using PlushEngine.Audio;)

A playing sequence, returned by Scene.PlaySequence: where it is (row, time), whether it still plays, its volume and Stop. A looping sequence plays until stopped or until its scene ends. With speakers (objects it plays from: AddSpeaker, or Audio Emitters naming the sequence) it is heard from each of them, fading with distance between MinDistance and MaxDistance; it is rendered once however many there are. Without speakers it plays flat.

public sealed class SequencePlayback

Members: AddSpeaker · Beat · IsPlaying · MaxDistance · MinDistance · Pattern · PatternRow · RemoveSpeaker · Rolloff · Row · Sequence · Speakers · Stop · Time · Volume · WaitUntilDone

AddSpeaker#

public void AddSpeaker(RuntimeEntity speaker, float volume = 1, float? minDistance = null, float? maxDistance = null);

Also play from this object, at its own level (linear) and, when given, its own distances: one more place to hear the same performance, with no extra voices.

Beat#

public double Beat { get; }

Beats played since the start (rows ÷ rows per beat): sync gameplay to the music.

IsPlaying#

public bool IsPlaying { get; }

False once a one-shot sequence has played its last row and its notes have ended, or after Stop.

MaxDistance#

public float MaxDistance { get; set; }

Initial value: 40

Silent beyond this distance of every speaker (metres).

MinDistance#

public float MinDistance { get; set; }

Initial value: 2

Full volume within this distance of a speaker (metres).

Pattern#

public int Pattern { get; }

The pattern playing now (its index in SoundSequence.Patterns).

PatternRow#

public int PatternRow { get; }

The row playing now within its pattern.

RemoveSpeaker#

public void RemoveSpeaker(RuntimeEntity speaker);

Rolloff#

public SoundRolloff Rolloff { get; set; }

Initial value: SoundRolloff.Inverse

Row#

public int Row { get; }

The row playing now, counted through the whole order (wraps for a looping sequence; the last row once a one-shot has passed it).

Sequence#

public SoundSequence Sequence { get; }

Speakers#

public IReadOnlyList<RuntimeEntity> Speakers { get; }

The objects it plays from (empty: flat). A destroyed or inactive speaker is silent.

Stop#

public void Stop(float fade = 0);

Stop: no further rows start, and playing notes fade out over fade seconds.

Time#

public double Time { get; }

Seconds of the sequence played (the audio clock: exact, unaffected by frame rate).

Volume#

public float Volume { get; set; }

Its level, 0 to 1 (and above), applied live.

WaitUntilDone#

public Wait WaitUntilDone();

For coroutines: yield return playback.WaitUntilDone();

RuntimeEntity · SoundRolloff · SoundSequence · Wait

Source#