reckfellENGINE

AudioStreamInteractive

Audio stream that can playback music interactively, combining clips and a transition table.

On this page
class AudioStreamInteractiveReckfellSharpInherits AudioStream

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
# AudioStreamInteractive
C#
public AudioStreamInteractive();

Properties3

ClipCountProperty
# ClipCount
C#
public int ClipCount { get; set; }

Amount of clips contained in this interactive player.

InitialClipProperty
# InitialClip
C#
public int InitialClip { get; set; }

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

_TransitionsProperty
# _Transitions
C#
public Reckfell.Collections.Dictionary _Transitions { get; set; }

Methods23

AddTransitionvoid
# AddTransition
C#
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_time indicates the moment in the current clip the transition will begin after triggered.
  • to_time indicates the time in the next clip that the playback will start from.
  • fade_mode indicates how the fade will happen between clips. If unsure, just use AudioStreamInteractive.FadeMode.Automatic which uses the most common type of fade for each situation.
  • fade_beats indicates how many beats the fade will take. Using decimals is allowed.
  • use_filler_clip indicates that there will be a filler clip used between the source and destination clips.
  • filler_clip the index of the filler clip.
  • If hold_previous is used, then this clip will be remembered. This can be used together with AudioStreamInteractive.AutoAdvanceMode.ReturnToHold to return to this clip after another is done playing.
Parameters
NameTypeDefault
fromClipint—
toClipint—
fromTimeAudioStreamInteractive.TransitionFromTime—
toTimeAudioStreamInteractive.TransitionToTime—
fadeModeAudioStreamInteractive.FadeMode—
fadeBeatsfloat—
useFillerClipboolfalse
fillerClipint-1
holdPreviousboolfalse
EraseTransitionvoid
# EraseTransition
C#
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.

Parameters
NameTypeDefault
fromClipint—
toClipint—
GetClipAutoAdvanceAudioStreamInteractive.AutoAdvanceMode
# GetClipAutoAdvance
C#
public AudioStreamInteractive.AutoAdvanceMode GetClipAutoAdvance(int clipIndex);

Return whether a clip has auto-advance enabled. See AudioStreamInteractive.SetClipAutoAdvance.

Parameters
NameTypeDefault
clipIndexint—
Returns AudioStreamInteractive.AutoAdvanceMode
GetClipAutoAdvanceNextClipint
# GetClipAutoAdvanceNextClip
C#
public int GetClipAutoAdvanceNextClip(int clipIndex);

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

Parameters
NameTypeDefault
clipIndexint—
Returns int
GetClipCountint
# GetClipCount
C#
public int GetClipCount();
Returns int
GetClipNameStringName
# GetClipName
C#
public StringName GetClipName(int clipIndex);

Return the name of a clip.

Parameters
NameTypeDefault
clipIndexint—
Returns StringName
GetClipStreamAudioStream
# GetClipStream
C#
public AudioStream GetClipStream(int clipIndex);

Return the AudioStream associated with a clip.

Parameters
NameTypeDefault
clipIndexint—
Returns AudioStream
GetInitialClipint
# GetInitialClip
C#
public int GetInitialClip();
Returns int
GetTransitionFadeBeatsfloat
# GetTransitionFadeBeats
C#
public float GetTransitionFadeBeats(int fromClip, int toClip);

Return the time (in beats) for a transition (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns float
GetTransitionFadeModeAudioStreamInteractive.FadeMode
# GetTransitionFadeMode
C#
public AudioStreamInteractive.FadeMode GetTransitionFadeMode(int fromClip, int toClip);

Return the mode for a transition (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns AudioStreamInteractive.FadeMode
GetTransitionFillerClipint
# GetTransitionFillerClip
C#
public int GetTransitionFillerClip(int fromClip, int toClip);

Return the filler clip for a transition (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns int
GetTransitionFromTimeAudioStreamInteractive.TransitionFromTime
# GetTransitionFromTime
C#
public AudioStreamInteractive.TransitionFromTime GetTransitionFromTime(int fromClip, int toClip);

Return the source time position for a transition (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns AudioStreamInteractive.TransitionFromTime
GetTransitionListint[]
# GetTransitionList
C#
public int[] GetTransitionList();

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

Returns int[]
GetTransitionToTimeAudioStreamInteractive.TransitionToTime
# GetTransitionToTime
C#
public AudioStreamInteractive.TransitionToTime GetTransitionToTime(int fromClip, int toClip);

Return the destination time position for a transition (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns AudioStreamInteractive.TransitionToTime
HasTransitionbool
# HasTransition
C#
public bool HasTransition(int fromClip, int toClip);

Returns true if a given transition exists (was added via AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns bool
IsTransitionHoldingPreviousbool
# IsTransitionHoldingPrevious
C#
public bool IsTransitionHoldingPrevious(int fromClip, int toClip);

Return whether a transition uses the hold previous functionality (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns bool
IsTransitionUsingFillerClipbool
# IsTransitionUsingFillerClip
C#
public bool IsTransitionUsingFillerClip(int fromClip, int toClip);

Return whether a transition uses the filler clip functionality (see AudioStreamInteractive.AddTransition).

Parameters
NameTypeDefault
fromClipint—
toClipint—
Returns bool
SetClipAutoAdvancevoid
# SetClipAutoAdvance
C#
public void SetClipAutoAdvance(int clipIndex, AudioStreamInteractive.AutoAdvanceMode mode);

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

Parameters
NameTypeDefault
clipIndexint—
modeAudioStreamInteractive.AutoAdvanceMode—
SetClipAutoAdvanceNextClipvoid
# SetClipAutoAdvanceNextClip
C#
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.

Parameters
NameTypeDefault
clipIndexint—
autoAdvanceNextClipint—
SetClipCountvoid
# SetClipCount
C#
public void SetClipCount(int clipCount);
Parameters
NameTypeDefault
clipCountint—
SetClipNamevoid
# SetClipName
C#
public void SetClipName(int clipIndex, StringName name);

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

Parameters
NameTypeDefault
clipIndexint—
nameStringName—
SetClipStreamvoid
# SetClipStream
C#
public void SetClipStream(int clipIndex, AudioStream stream);

Set the AudioStream associated with the current clip.

Parameters
NameTypeDefault
clipIndexint—
streamAudioStream—
SetInitialClipvoid
# SetInitialClip
C#
public void SetInitialClip(int clipIndex);
Parameters
NameTypeDefault
clipIndexint—

Fields and constants1

ClipAnyField
# ClipAny
C#
public const long ClipAny = -1;

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

AudioStreamInteractive.AutoAdvanceMode

ValueDescription
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.AddTransition).

AudioStreamInteractive.FadeMode

ValueDescription
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

ValueDescription
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

ValueDescription
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.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.