Documentation
¶
Overview ¶
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 Instance.AddTransition. Additionally, this stream exports a property parameter to control the playback via graphics.gd/classdb/AudioStreamPlayer, graphics.gd/classdb/AudioStreamPlayer2D, or graphics.gd/classdb/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.
Index ¶
- type Advanced
- type Any
- type AutoAdvanceMode
- type Clip
- type Expanded
- type Extension
- type FadeMode
- type ID
- type Instance
- func (self Instance) AddTransition(from_clip Clip, to_clip Clip, from_time TransitionFromTime, ...)
- func (self Instance) AsAudioStream() AudioStream.Instance
- func (self Instance) AsAudioStreamInteractive() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) ClipCount() int
- func (self Instance) EraseTransition(from_clip Clip, to_clip Clip)
- func (self Instance) GetClipAutoAdvance(clip_index Clip) AutoAdvanceMode
- func (self Instance) GetClipAutoAdvanceNextClip(clip_index Clip) int
- func (self Instance) GetClipName(clip_index Clip) string
- func (self Instance) GetClipStream(clip_index Clip) AudioStream.Instance
- func (self Instance) GetTransitionFadeBeats(from_clip Clip, to_clip Clip) Float.X
- func (self Instance) GetTransitionFadeMode(from_clip Clip, to_clip Clip) FadeMode
- func (self Instance) GetTransitionFillerClip(from_clip Clip, to_clip Clip) int
- func (self Instance) GetTransitionFromTime(from_clip Clip, to_clip Clip) TransitionFromTime
- func (self Instance) GetTransitionList() []int32
- func (self Instance) GetTransitionToTime(from_clip Clip, to_clip Clip) TransitionToTime
- func (self Instance) HasTransition(from_clip Clip, to_clip Clip) bool
- func (self Instance) ID() ID
- func (self Instance) InitialClip() int
- func (self Instance) IsTransitionHoldingPrevious(from_clip Clip, to_clip Clip) bool
- func (self Instance) IsTransitionUsingFillerClip(from_clip Clip, to_clip Clip) bool
- func (self Instance) SetClipAutoAdvance(clip_index Clip, mode AutoAdvanceMode)
- func (self Instance) SetClipAutoAdvanceNextClip(clip_index Clip, auto_advance_next_clip Clip)
- func (self Instance) SetClipCount(value int)
- func (self Instance) SetClipName(clip_index Clip, name string)
- func (self Instance) SetClipStream(clip_index Clip, stream AudioStream.Instance)
- func (self Instance) SetInitialClip(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type TransitionFromTime
- type TransitionToTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type AutoAdvanceMode ¶
type AutoAdvanceMode int //gd:AudioStreamInteractive.AutoAdvanceMode
const ( // Disable auto-advance (default). AutoAdvanceDisabled AutoAdvanceMode = 0 // Enable auto-advance, a clip must be specified. AutoAdvanceEnabled AutoAdvanceMode = 1 // Enable auto-advance, but instead of specifying a clip, the playback will return to hold (see [Instance.AddTransition]). AutoAdvanceReturnToHold AutoAdvanceMode = 2 )
type Expanded ¶
type Expanded [1]gdclass.AudioStreamInteractive
func (Expanded) AddTransition ¶
func (self Expanded) AddTransition(from_clip Clip, to_clip Clip, from_time TransitionFromTime, to_time TransitionToTime, fade_mode FadeMode, fade_beats Float.X, use_filler_clip bool, filler_clip Clip, hold_previous 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.
* '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 FadeAutomatic 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 AutoAdvanceReturnToHold to return to this clip after another is done playing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsAudioStream ¶
func (self *Extension[T]) AsAudioStream() AudioStream.Instance
func (*Extension[T]) AsAudioStreamInteractive ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type FadeMode ¶
type FadeMode int //gd:AudioStreamInteractive.FadeMode
const ( // 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. FadeDisabled FadeMode = 0 // Use a fade-in in the next clip, let the current clip finish. FadeIn FadeMode = 1 // Use a fade-out in the current clip, the next clip will start by itself. FadeOut FadeMode = 2 // Use a cross-fade between clips. FadeCross FadeMode = 3 // Use automatic fade logic depending on the transition from/to. It is recommended to use this by default. FadeAutomatic FadeMode = 4 )
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.AudioStreamInteractive
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddTransition ¶
func (self Instance) AddTransition(from_clip Clip, to_clip Clip, from_time TransitionFromTime, to_time TransitionToTime, fade_mode FadeMode, fade_beats Float.X)
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.
* '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 FadeAutomatic 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 AutoAdvanceReturnToHold to return to this clip after another is done playing.
func (Instance) AsAudioStream ¶
func (self Instance) AsAudioStream() AudioStream.Instance
func (Instance) AsAudioStreamInteractive ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) EraseTransition ¶
Erase a transition by providing 'from_clip' and 'to_clip' clip indices. ClipAny can be used for either argument or both.
func (Instance) GetClipAutoAdvance ¶
func (self Instance) GetClipAutoAdvance(clip_index Clip) AutoAdvanceMode
Return whether a clip has auto-advance enabled. See Instance.SetClipAutoAdvance.
func (Instance) GetClipAutoAdvanceNextClip ¶
Return the clip towards which the clip referenced by 'clip_index' will auto-advance to.
func (Instance) GetClipName ¶
Return the name of a clip.
func (Instance) GetClipStream ¶
func (self Instance) GetClipStream(clip_index Clip) AudioStream.Instance
Return the graphics.gd/classdb/AudioStream associated with a clip.
func (Instance) GetTransitionFadeBeats ¶
Return the time (in beats) for a transition (see Instance.AddTransition).
func (Instance) GetTransitionFadeMode ¶
Return the mode for a transition (see Instance.AddTransition).
func (Instance) GetTransitionFillerClip ¶
Return the filler clip for a transition (see Instance.AddTransition).
func (Instance) GetTransitionFromTime ¶
func (self Instance) GetTransitionFromTime(from_clip Clip, to_clip Clip) TransitionFromTime
Return the source time position for a transition (see Instance.AddTransition).
func (Instance) GetTransitionList ¶
Return the list of transitions (from, to interleaved).
func (Instance) GetTransitionToTime ¶
func (self Instance) GetTransitionToTime(from_clip Clip, to_clip Clip) TransitionToTime
Return the destination time position for a transition (see Instance.AddTransition).
func (Instance) HasTransition ¶
Returns true if a given transition exists (was added via Instance.AddTransition).
func (Instance) InitialClip ¶
func (Instance) IsTransitionHoldingPrevious ¶
Return whether a transition uses the hold previous functionality (see Instance.AddTransition).
func (Instance) IsTransitionUsingFillerClip ¶
Return whether a transition uses the filler clip functionality (see Instance.AddTransition).
func (Instance) SetClipAutoAdvance ¶
func (self Instance) SetClipAutoAdvance(clip_index Clip, mode AutoAdvanceMode)
Set whether a clip will auto-advance by changing the auto-advance mode.
func (Instance) SetClipAutoAdvanceNextClip ¶
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.
func (Instance) SetClipCount ¶
func (Instance) SetClipName ¶
Set the name of the current clip (for easier identification).
func (Instance) SetClipStream ¶
func (self Instance) SetClipStream(clip_index Clip, stream AudioStream.Instance)
Set the graphics.gd/classdb/AudioStream associated with the current clip.
func (Instance) SetInitialClip ¶
type TransitionFromTime ¶
type TransitionFromTime int //gd:AudioStreamInteractive.TransitionFromTime
const ( // Start transition as soon as possible, don't wait for any specific time position. TransitionFromTimeImmediate TransitionFromTime = 0 // Transition when the clip playback position reaches the next beat. TransitionFromTimeNextBeat TransitionFromTime = 1 // Transition when the clip playback position reaches the next bar. TransitionFromTimeNextBar TransitionFromTime = 2 // Transition when the current clip finished playing. TransitionFromTimeEnd TransitionFromTime = 3 )
type TransitionToTime ¶
type TransitionToTime int //gd:AudioStreamInteractive.TransitionToTime
const ( // 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. TransitionToTimeSamePosition TransitionToTime = 0 // Transition to the start of the destination clip. TransitionToTimeStart TransitionToTime = 1 )