AudioStreamInteractive
Audio stream that can playback music interactively, combining clips and a transition table.
Audio stream that can playback music interactively, combining clips and a transition table.
This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and then the transition rules via the AudioStreamInteractive.AddTransition. Additionally, this stream exports 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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
AudioStreamInteractiveConstructor
public AudioStreamInteractive();Properties3
ClipCountProperty
public int ClipCount { get; set; }Amount of clips contained in this interactive player.
InitialClipProperty
public int InitialClip { get; set; }Index of the initial clip, which will be played first when this stream is played.
_TransitionsProperty
public Reckfell.Collections.Dictionary _Transitions { get; set; }Methods23
AddTransitionvoid
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);Add a transition between two clips. Provide the indices of the source and destination clips, or use the AudioStreamInteractive.ClipAny constant to indicate that transition happens to/from any clip to this one.
from_timeindicates the moment in the current clip the transition will begin after triggered.to_timeindicates the time in the next clip that the playback will start from.fade_modeindicates how the fade will happen between clips. If unsure, just useAudioStreamInteractive.FadeMode.Automaticwhich uses the most common type of fade for each situation.fade_beatsindicates how many beats the fade will take. Using decimals is allowed.use_filler_clipindicates that there will be a filler clip used between the source and destination clips.filler_clipthe index of the filler clip.- If
hold_previousis used, then this clip will be remembered. This can be used together withAudioStreamInteractive.AutoAdvanceMode.ReturnToHoldto return to this clip after another is done playing.
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
fromTime | AudioStreamInteractive.TransitionFromTime | — |
toTime | AudioStreamInteractive.TransitionToTime | — |
fadeMode | AudioStreamInteractive.FadeMode | — |
fadeBeats | float | — |
useFillerClip | bool | false |
fillerClip | int | -1 |
holdPrevious | bool | false |
EraseTransitionvoid
public void EraseTransition(int fromClip, int toClip);Erase a transition by providing from_clip and to_clip clip indices. AudioStreamInteractive.ClipAny can be used for either argument or both.
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
GetClipAutoAdvanceAudioStreamInteractive.AutoAdvanceMode
public AudioStreamInteractive.AutoAdvanceMode GetClipAutoAdvance(int clipIndex);Return whether a clip has auto-advance enabled. See AudioStreamInteractive.SetClipAutoAdvance.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
AudioStreamInteractive.AutoAdvanceModeGetClipAutoAdvanceNextClipint
public int GetClipAutoAdvanceNextClip(int clipIndex);Return the clip towards which the clip referenced by clip_index will auto-advance to.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
intGetClipCountint
public int GetClipCount();intGetClipNameStringName
public StringName GetClipName(int clipIndex);Return the name of a clip.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
StringNameGetClipStreamAudioStream
public AudioStream GetClipStream(int clipIndex);Return the AudioStream associated with a clip.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
AudioStreamGetInitialClipint
public int GetInitialClip();intGetTransitionFadeBeatsfloat
public float GetTransitionFadeBeats(int fromClip, int toClip);Return the time (in beats) for a transition (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
floatGetTransitionFadeModeAudioStreamInteractive.FadeMode
public AudioStreamInteractive.FadeMode GetTransitionFadeMode(int fromClip, int toClip);Return the mode for a transition (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
AudioStreamInteractive.FadeModeGetTransitionFillerClipint
public int GetTransitionFillerClip(int fromClip, int toClip);Return the filler clip for a transition (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
intGetTransitionFromTimeAudioStreamInteractive.TransitionFromTime
public AudioStreamInteractive.TransitionFromTime GetTransitionFromTime(int fromClip, int toClip);Return the source time position for a transition (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
AudioStreamInteractive.TransitionFromTimeGetTransitionListint[]
public int[] GetTransitionList();Return the list of transitions (from, to interleaved).
int[]GetTransitionToTimeAudioStreamInteractive.TransitionToTime
public AudioStreamInteractive.TransitionToTime GetTransitionToTime(int fromClip, int toClip);Return the destination time position for a transition (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
AudioStreamInteractive.TransitionToTimeHasTransitionbool
public bool HasTransition(int fromClip, int toClip);Returns true if a given transition exists (was added via AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
boolIsTransitionHoldingPreviousbool
public bool IsTransitionHoldingPrevious(int fromClip, int toClip);Return whether a transition uses the hold previous functionality (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
boolIsTransitionUsingFillerClipbool
public bool IsTransitionUsingFillerClip(int fromClip, int toClip);Return whether a transition uses the filler clip functionality (see AudioStreamInteractive.AddTransition).
| Name | Type | Default |
|---|---|---|
fromClip | int | — |
toClip | int | — |
boolSetClipAutoAdvancevoid
public void SetClipAutoAdvance(int clipIndex, AudioStreamInteractive.AutoAdvanceMode mode);Set whether a clip will auto-advance by changing the auto-advance mode.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
mode | AudioStreamInteractive.AutoAdvanceMode | — |
SetClipAutoAdvanceNextClipvoid
public void SetClipAutoAdvanceNextClip(int clipIndex, int autoAdvanceNextClip);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.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
autoAdvanceNextClip | int | — |
SetClipCountvoid
public void SetClipCount(int clipCount);| Name | Type | Default |
|---|---|---|
clipCount | int | — |
SetClipNamevoid
public void SetClipName(int clipIndex, StringName name);Set the name of the current clip (for easier identification).
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
name | StringName | — |
SetClipStreamvoid
public void SetClipStream(int clipIndex, AudioStream stream);Set the AudioStream associated with the current clip.
| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
stream | AudioStream | — |
SetInitialClipvoid
public void SetInitialClip(int clipIndex);| Name | Type | Default |
|---|---|---|
clipIndex | int | — |
Fields and constants1
ClipAnyField
public const long ClipAny = -1;This constant describes that any clip is valid for a specific transition as either source or destination.
AudioStreamInteractive.AutoAdvanceMode
| Value | Description |
|---|---|
Disabled = 0 | Disable auto-advance (default). |
Enabled = 1 | Enable auto-advance, a clip must be specified. |
ReturnToHold = 2 | Enable auto-advance, but instead of specifying a clip, the playback will return to hold (see |
AudioStreamInteractive.FadeMode
| Value | Description |
|---|---|
Automatic = 4 | Use automatic fade logic depending on the transition from/to. It is recommended to use this by default. |
Cross = 3 | Use a cross-fade between clips. |
Disabled = 0 | Do not use fade for the transition. This is useful when transitioning from a clip-end to clip-beginning, and each clip has their begin/end. |
In = 1 | Use a fade-in in the next clip, let the current clip finish. |
Out = 2 | Use a fade-out in the current clip, the next clip will start by itself. |
AudioStreamInteractive.TransitionFromTime
| Value | Description |
|---|---|
End = 3 | Transition when the current clip finished playing. |
Immediate = 0 | Start transition as soon as possible, don't wait for any specific time position. |
NextBar = 2 | Transition when the clip playback position reaches the next bar. |
NextBeat = 1 | Transition when the clip playback position reaches the next beat. |
AudioStreamInteractive.TransitionToTime
| Value | Description |
|---|---|
PreviousPosition = 2 | Transition to the last played position in the destination clip, if there was a previous transition from that clip. Otherwise, plays from the start of the destination clip. |
SamePosition = 0 | Transition to the same position in the destination clip. This is useful when both clips have exactly the same length and the music should fade between them. |
Start = 1 | Transition to the start of the destination clip. |