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
Properties
ClipCount
Amount of clips contained in this interactive player.
public int ClipCount { get; set; }
Property Value
InitialClip
Index of the initial clip, which will be played first when this stream is played.
public int InitialClip { get; set; }
Property Value
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
inttoClip
intfromTime
AudioStreamInteractive.TransitionFromTimetoTime
AudioStreamInteractive.TransitionToTimefadeMode
AudioStreamInteractive.FadeModefadeBeats
floatuseFillerClip
boolfillerClip
intholdPrevious
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
GetClipAutoAdvance(int)
Return whether a clip has auto-advance enabled. See SetClipAutoAdvance(int, AutoAdvanceMode).
public AudioStreamInteractive.AutoAdvanceMode GetClipAutoAdvance(int clipIndex)
Parameters
clipIndex
int
Returns
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
GetClipName(int)
Return the name of a clip.
public StringName GetClipName(int clipIndex)
Parameters
clipIndex
int
Returns
GetClipStream(int)
Return the AudioStream associated with a clip.
public AudioStream GetClipStream(int clipIndex)
Parameters
clipIndex
int
Returns
GetTransitionFadeBeats(int, int)
Return the time (in beats) for a transition (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).
public float GetTransitionFadeBeats(int fromClip, int toClip)
Parameters
Returns
GetTransitionFadeMode(int, int)
Return the mode for a transition (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).
public AudioStreamInteractive.FadeMode GetTransitionFadeMode(int fromClip, int toClip)
Parameters
Returns
GetTransitionFillerClip(int, int)
Return the filler clip for a transition (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).
public int GetTransitionFillerClip(int fromClip, int toClip)
Parameters
Returns
GetTransitionFromTime(int, int)
Return the source time position for a transition (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).
public AudioStreamInteractive.TransitionFromTime GetTransitionFromTime(int fromClip, int toClip)
Parameters
Returns
GetTransitionList()
Return the list of transitions (from, to interleaved).
public int[] GetTransitionList()
Returns
- int[]
GetTransitionToTime(int, int)
Return the destination time position for a transition (see AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).
public AudioStreamInteractive.TransitionToTime GetTransitionToTime(int fromClip, int toClip)
Parameters
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
HasTransition(int, int)
Return true if a given transition exists (was added via AddTransition(int, int, TransitionFromTime, TransitionToTime, FadeMode, float, bool, int, bool)).
public bool HasTransition(int fromClip, int toClip)
Parameters
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
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
Returns
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
Returns
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
intmode
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
SetClipName(int, StringName)
Set the name of the current clip (for easier identification).
public void SetClipName(int clipIndex, StringName name)
Parameters
clipIndex
intname
StringName
SetClipStream(int, AudioStream)
Set the AudioStream associated with the current clip.
public void SetClipStream(int clipIndex, AudioStream stream)
Parameters
clipIndex
intstream
AudioStream