Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
- Animation
- AnimationLibrary
- AnimationNode (6)
- AnimationNodeStateMachinePlayback
- AnimationNodeStateMachineTransition
- AudioBusLayout
- AudioEffect (17)
- AudioStream (10)
- BitMap
- BoneMap
- ButtonGroup
- CameraAttributes (2)
- ColorPalette
- Compositor
- CompositorEffect
- CryptoKey
- Curve
- Curve2D
- Curve3D
- EditorNode3DGizmoPlugin
- EditorSettings
- Environment
- Font (3)
- GDExtension
- GLTFAccessor
- GLTFAnimation
- GLTFBufferView
- GLTFCamera
- GLTFDocument (1)
- GLTFDocumentExtension (1)
- GLTFLight
- GLTFMesh
- GLTFNode
- GLTFPhysicsBody
- GLTFPhysicsShape
- GLTFSkeleton
- GLTFSkin
- GLTFSpecGloss
- GLTFState (1)
- GLTFTexture
- GLTFTextureSampler
- Gradient
- Image
- ImporterMesh
- InputEvent (6)
- JSON
- LabelSettings
- LightmapGIData
- Material (9)
- Mesh (4)
- MeshLibrary
- MissingResource
- MultiMesh
- NavigationMesh
- NavigationMeshSourceGeometryData2D
- NavigationMeshSourceGeometryData3D
- NavigationPolygon
- Noise (1)
- Occluder3D (5)
- OccluderPolygon2D
- OggPacketSequence
- OpenXRAction
- OpenXRActionMap
- OpenXRActionSet
- OpenXRBindingModifier (2)
- OpenXRHapticBase (1)
- OpenXRIPBinding
- OpenXRInteractionProfile
- PackedDataContainer
- PackedScene
- PhysicsMaterial
- PolygonPathFinder
- RDShaderFile
- RDShaderSPIRV
- RichTextEffect
- SceneReplicationConfig
- Script (3)
- Shader (1)
- ShaderInclude
- Shape2D (8)
- Shape3D (9)
- Shortcut
- SkeletonModification2D (7)
- SkeletonModificationStack2D
- SkeletonProfile (1)
- Skin
- Sky
- SpriteFrames
- StyleBox (4)
- SyntaxHighlighter (2)
- Texture (3)
- Theme
- TileMapPattern
- TileSet
- TileSetSource (2)
- Translation (1)
- VideoStream (1)
- VideoStreamPlayback
- VisualShaderNode (62)
- VoxelGIData
- World2D
- World3D
- X509Certificate
- AudioStreamGenerator
- AudioStreamInteractive
- AudioStreamMP3
- AudioStreamMicrophone
- AudioStreamOggVorbis
- AudioStreamPlaylist
- AudioStreamPolyphonic
- AudioStreamRandomizer
- AudioStreamSynchronized
- AudioStreamWAV
Table of contents
-
var clip_count: int = 0 -
var initial_clip: int = 0 -
func add_transition(hold_previous: bool = false) -> void -
func erase_transition(to_clip: int) -> void -
const func get_clip_auto_advance(clip_index: int) -> intAudioStreamInteractive.AutoAdvanceMode -
const func get_clip_auto_advance_next_clip(clip_index: int) -> int -
const func get_clip_name(clip_index: int) -> StringName -
const func get_clip_stream(clip_index: int) -> AudioStream -
const func get_transition_fade_beats(to_clip: int) -> float -
const func get_transition_fade_mode(to_clip: int) -> intAudioStreamInteractive.FadeMode -
const func get_transition_filler_clip(to_clip: int) -> int -
const func get_transition_from_time(to_clip: int) -> intAudioStreamInteractive.TransitionFromTime -
const func get_transition_list() -> PackedInt32Array -
const func get_transition_to_time(to_clip: int) -> intAudioStreamInteractive.TransitionToTime -
const func has_transition(to_clip: int) -> bool -
const func is_transition_holding_previous(to_clip: int) -> bool -
const func is_transition_using_filler_clip(to_clip: int) -> bool -
func set_clip_auto_advance(mode: int enumAudioStreamInteractive.AutoAdvanceMode) -> void -
func set_clip_auto_advance_next_clip(auto_advance_next_clip: int) -> void -
func set_clip_name(name: StringName) -> void -
func set_clip_stream(stream: AudioStream) -> void -
const TRANSITION_FROM_TIME_IMMEDIATE = 0 enum TransitionFromTime -
const TRANSITION_FROM_TIME_NEXT_BEAT = 1 enum TransitionFromTime -
const TRANSITION_FROM_TIME_NEXT_BAR = 2 enum TransitionFromTime -
const TRANSITION_FROM_TIME_END = 3 enum TransitionFromTime -
const TRANSITION_TO_TIME_SAME_POSITION = 0 enum TransitionToTime -
const TRANSITION_TO_TIME_START = 1 enum TransitionToTime -
const FADE_DISABLED = 0 enum FadeMode -
const FADE_IN = 1 enum FadeMode -
const FADE_OUT = 2 enum FadeMode -
const FADE_CROSS = 3 enum FadeMode -
const FADE_AUTOMATIC = 4 enum FadeMode -
const AUTO_ADVANCE_DISABLED = 0 enum AutoAdvanceMode -
const AUTO_ADVANCE_ENABLED = 1 enum AutoAdvanceMode -
const AUTO_ADVANCE_RETURN_TO_HOLD = 2 enum AutoAdvanceMode -
const CLIP_ANY = -1 -
enum TransitionFromTime -
enum TransitionToTime -
enum FadeMode -
enum AutoAdvanceMode
AudioStreamInteractive #
is_refcounted, is_instantiable, resource, core, not_builtin_classes
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 add_transition. 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.
Members #
var clip_count: int = 0#
Amount of clips contained in this interactive player.
var initial_clip: int = 0#
Index of the initial clip, which will be played first when this stream is played.
Methods #
func add_transition(hold_previous: bool = false) -> void#
Add a transition between two clips. Provide the indices of the source and destination clips, or use the CLIP_ANY 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 FADE_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 AUTO_ADVANCE_RETURN_TO_HOLD to return to this clip after another is done playing.
func erase_transition(to_clip: int) -> void#
Erase a transition by providing from_clip and to_clip clip indices. CLIP_ANY can be used for either argument or both.
const func get_clip_auto_advance(clip_index: int) -> intAudioStreamInteractive.AutoAdvanceMode#
Return whether a clip has auto-advance enabled. See set_clip_auto_advance.
const func get_clip_auto_advance_next_clip(clip_index: int) -> int#
Return the clip towards which the clip referenced by clip_index will auto-advance to.
const func get_clip_name(clip_index: int) -> StringName#
Return the name of a clip.
const func get_clip_stream(clip_index: int) -> AudioStream#
Return the AudioStream associated with a clip.
const func get_transition_fade_beats(to_clip: int) -> float#
Return the time (in beats) for a transition (see add_transition).
const func get_transition_fade_mode(to_clip: int) -> intAudioStreamInteractive.FadeMode#
Return the mode for a transition (see add_transition).
const func get_transition_filler_clip(to_clip: int) -> int#
Return the filler clip for a transition (see add_transition).
const func get_transition_from_time(to_clip: int) -> intAudioStreamInteractive.TransitionFromTime#
Return the source time position for a transition (see add_transition).
const func get_transition_list() -> PackedInt32Array#
Return the list of transitions (from, to interleaved).
const func get_transition_to_time(to_clip: int) -> intAudioStreamInteractive.TransitionToTime#
Return the destination time position for a transition (see add_transition).
const func has_transition(to_clip: int) -> bool#
Returns true if a given transition exists (was added via add_transition).
const func is_transition_holding_previous(to_clip: int) -> bool#
Return whether a transition uses the hold previous functionality (see add_transition).
const func is_transition_using_filler_clip(to_clip: int) -> bool#
Return whether a transition uses the filler clip functionality (see add_transition).
func set_clip_auto_advance(mode: int enumAudioStreamInteractive.AutoAdvanceMode) -> void#
Set whether a clip will auto-advance by changing the auto-advance mode.
func set_clip_auto_advance_next_clip(auto_advance_next_clip: int) -> void#
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 set_clip_name(name: StringName) -> void#
Set the name of the current clip (for easier identification).
func set_clip_stream(stream: AudioStream) -> void#
Set the AudioStream associated with the current clip.
Annotations #
Constants #
const TRANSITION_FROM_TIME_IMMEDIATE = 0 enum TransitionFromTime#
Start transition as soon as possible, don't wait for any specific time position.
const TRANSITION_FROM_TIME_NEXT_BEAT = 1 enum TransitionFromTime#
Transition when the clip playback position reaches the next beat.
const TRANSITION_FROM_TIME_NEXT_BAR = 2 enum TransitionFromTime#
Transition when the clip playback position reaches the next bar.
const TRANSITION_FROM_TIME_END = 3 enum TransitionFromTime#
Transition when the current clip finished playing.
const TRANSITION_TO_TIME_SAME_POSITION = 0 enum TransitionToTime#
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.
const TRANSITION_TO_TIME_START = 1 enum TransitionToTime#
Transition to the start of the destination clip.
const FADE_DISABLED = 0 enum FadeMode#
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.
const FADE_IN = 1 enum FadeMode#
Use a fade-in in the next clip, let the current clip finish.
const FADE_OUT = 2 enum FadeMode#
Use a fade-out in the current clip, the next clip will start by itself.
const FADE_CROSS = 3 enum FadeMode#
Use a cross-fade between clips.
const FADE_AUTOMATIC = 4 enum FadeMode#
Use automatic fade logic depending on the transition from/to. It is recommended to use this by default.
const AUTO_ADVANCE_DISABLED = 0 enum AutoAdvanceMode#
Disable auto-advance (default).
const AUTO_ADVANCE_ENABLED = 1 enum AutoAdvanceMode#
Enable auto-advance, a clip must be specified.
const AUTO_ADVANCE_RETURN_TO_HOLD = 2 enum AutoAdvanceMode#
Enable auto-advance, but instead of specifying a clip, the playback will return to hold (see add_transition).
const CLIP_ANY = -1#
This constant describes that any clip is valid for a specific transition as either source or destination.
Constructors #
Enums #
TransitionFromTime#
enum TransitionFromTime {
TRANSITION_FROM_TIME_IMMEDIATE = 0,
TRANSITION_FROM_TIME_NEXT_BEAT = 1,
TRANSITION_FROM_TIME_NEXT_BAR = 2,
TRANSITION_FROM_TIME_END = 3,
}TransitionToTime#
enum TransitionToTime {
TRANSITION_TO_TIME_SAME_POSITION = 0,
TRANSITION_TO_TIME_START = 1,
}FadeMode#
enum FadeMode {
FADE_DISABLED = 0,
FADE_IN = 1,
FADE_OUT = 2,
FADE_CROSS = 3,
FADE_AUTOMATIC = 4,
}AutoAdvanceMode#
enum AutoAdvanceMode {
AUTO_ADVANCE_DISABLED = 0,
AUTO_ADVANCE_ENABLED = 1,
AUTO_ADVANCE_RETURN_TO_HOLD = 2,
} Notifications#
enum {
CLIP_ANY = -1,
}