Table of Contents

Class AudioStreamInteractive

Namespace
Godot
Assembly
GodotSharp.dll

This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and the transition rules via the AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool). Additionally, this stream export a property parameter to control the playback via AudioStreamPlayer, AudioStreamPlayer2D, or AudioStreamPlayer3D.

The way this is used is by filling a number of clips, then configuring the transition table. From there, clips are selected for playback and the music will smoothly go from the current to the new one while using the corresponding transition rule defined in the transition table.

public class AudioStreamInteractive : AudioStream, IDisposable
Inheritance
AudioStreamInteractive
Implements
Inherited Members

Constructors

AudioStreamInteractive()

public AudioStreamInteractive()

Fields

ClipAny

This constant describes that any clip is valid for a specific transition as either source or destination.

public const long ClipAny = -1

Field Value

long

Properties

ClipCount

Amount of clips contained in this interactive player.

public int ClipCount { get; set; }

Property Value

int

InitialClip

Index of the initial clip, which will be played first when this stream is played.

public int InitialClip { get; set; }

Property Value

int

Methods

AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)

Add a transition between two clips. Provide the indices of the source and destination clips, or use the ClipAny constant to indicate that transition happens to/from any clip to this one.

* fromTime indicates the moment in the current clip the transition will begin after triggered.

* toTime indicates the time in the next clip that the playback will start from.

* fadeMode indicates how the fade will happen between clips. If unsure, just use Automatic which uses the most common type of fade for each situation.

* fadeBeats indicates how many beats the fade will take. Using decimals is allowed.

* useFillerClip indicates that there will be a filler clip used between the source and destination clips.

* fillerClip the index of the filler clip.

* If holdPrevious is used, then this clip will be remembered. This can be used together with ReturnToHold to return to this clip after another is done playing.

public void AddTransition(int fromClip, int toClip, AudioStreamInteractive.TransitionFromTime fromTime, AudioStreamInteractive.TransitionToTime toTime, AudioStreamInteractive.FadeMode fadeMode, float fadeBeats, bool useFillerClip = false, int fillerClip = -1, bool holdPrevious = false)

Parameters

fromClip int
toClip int
fromTime AudioStreamInteractive.TransitionFromTime
toTime AudioStreamInteractive.TransitionToTime
fadeMode AudioStreamInteractive.FadeMode
fadeBeats float
useFillerClip bool
fillerClip int
holdPrevious bool

EraseTransition(int, int)

Erase a transition by providing fromClip and toClip clip indices. ClipAny can be used for either argument or both.

public void EraseTransition(int fromClip, int toClip)

Parameters

fromClip int
toClip int

GetClipAutoAdvance(int)

Return whether a clip has auto-advance enabled. See SetClipAutoAdvance(int, AutoAdvanceMode).

public AudioStreamInteractive.AutoAdvanceMode GetClipAutoAdvance(int clipIndex)

Parameters

clipIndex int

Returns

AudioStreamInteractive.AutoAdvanceMode

GetClipAutoAdvanceNextClip(int)

Return the clip towards which the clip referenced by clipIndex will auto-advance to.

public int GetClipAutoAdvanceNextClip(int clipIndex)

Parameters

clipIndex int

Returns

int

GetClipName(int)

Return the name of a clip.

public StringName GetClipName(int clipIndex)

Parameters

clipIndex int

Returns

StringName

GetClipStream(int)

Return the AudioStream associated with a clip.

public AudioStream GetClipStream(int clipIndex)

Parameters

clipIndex int

Returns

AudioStream

GetTransitionFadeBeats(int, int)

public float GetTransitionFadeBeats(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

float

GetTransitionFadeMode(int, int)

public AudioStreamInteractive.FadeMode GetTransitionFadeMode(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

AudioStreamInteractive.FadeMode

GetTransitionFillerClip(int, int)

public int GetTransitionFillerClip(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

int

GetTransitionFromTime(int, int)

public AudioStreamInteractive.TransitionFromTime GetTransitionFromTime(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

AudioStreamInteractive.TransitionFromTime

GetTransitionList()

Return the list of transitions (from, to interleaved).

public int[] GetTransitionList()

Returns

int[]

GetTransitionToTime(int, int)

public AudioStreamInteractive.TransitionToTime GetTransitionToTime(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

AudioStreamInteractive.TransitionToTime

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

HasTransition(int, int)

public bool HasTransition(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsTransitionHoldingPrevious(int, int)

Return whether a transition uses the hold previous functionality (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).

public bool IsTransitionHoldingPrevious(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

bool

IsTransitionUsingFillerClip(int, int)

Return whether a transition uses the filler clip functionality (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).

public bool IsTransitionUsingFillerClip(int fromClip, int toClip)

Parameters

fromClip int
toClip int

Returns

bool

SetClipAutoAdvance(int, AutoAdvanceMode)

Set whether a clip will auto-advance by changing the auto-advance mode.

public void SetClipAutoAdvance(int clipIndex, AudioStreamInteractive.AutoAdvanceMode mode)

Parameters

clipIndex int
mode AudioStreamInteractive.AutoAdvanceMode

SetClipAutoAdvanceNextClip(int, int)

Set the index of the next clip towards which this clip will auto advance to when finished. If the clip being played loops, then auto-advance will be ignored.

public void SetClipAutoAdvanceNextClip(int clipIndex, int autoAdvanceNextClip)

Parameters

clipIndex int
autoAdvanceNextClip int

SetClipName(int, StringName)

Set the name of the current clip (for easier identification).

public void SetClipName(int clipIndex, StringName name)

Parameters

clipIndex int
name StringName

SetClipStream(int, AudioStream)

Set the AudioStream associated with the current clip.

public void SetClipStream(int clipIndex, AudioStream stream)

Parameters

clipIndex int
stream AudioStream