Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/modules/interactive_music/doc_classes/AudioStreamInteractive.xml
10278 views
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<class name="AudioStreamInteractive" inherits="AudioStream" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
3
<brief_description>
4
Audio stream that can playback music interactively, combining clips and a transition table.
5
</brief_description>
6
<description>
7
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 [method add_transition]. Additionally, this stream exports a property parameter to control the playback via [AudioStreamPlayer], [AudioStreamPlayer2D], or [AudioStreamPlayer3D].
8
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.
9
</description>
10
<tutorials>
11
</tutorials>
12
<methods>
13
<method name="add_transition">
14
<return type="void" />
15
<param index="0" name="from_clip" type="int" />
16
<param index="1" name="to_clip" type="int" />
17
<param index="2" name="from_time" type="int" enum="AudioStreamInteractive.TransitionFromTime" />
18
<param index="3" name="to_time" type="int" enum="AudioStreamInteractive.TransitionToTime" />
19
<param index="4" name="fade_mode" type="int" enum="AudioStreamInteractive.FadeMode" />
20
<param index="5" name="fade_beats" type="float" />
21
<param index="6" name="use_filler_clip" type="bool" default="false" />
22
<param index="7" name="filler_clip" type="int" default="-1" />
23
<param index="8" name="hold_previous" type="bool" default="false" />
24
<description>
25
Add a transition between two clips. Provide the indices of the source and destination clips, or use the [constant CLIP_ANY] constant to indicate that transition happens to/from any clip to this one.
26
* [param from_time] indicates the moment in the current clip the transition will begin after triggered.
27
* [param to_time] indicates the time in the next clip that the playback will start from.
28
* [param fade_mode] indicates how the fade will happen between clips. If unsure, just use [constant FADE_AUTOMATIC] which uses the most common type of fade for each situation.
29
* [param fade_beats] indicates how many beats the fade will take. Using decimals is allowed.
30
* [param use_filler_clip] indicates that there will be a filler clip used between the source and destination clips.
31
* [param filler_clip] the index of the filler clip.
32
* If [param hold_previous] is used, then this clip will be remembered. This can be used together with [constant AUTO_ADVANCE_RETURN_TO_HOLD] to return to this clip after another is done playing.
33
</description>
34
</method>
35
<method name="erase_transition">
36
<return type="void" />
37
<param index="0" name="from_clip" type="int" />
38
<param index="1" name="to_clip" type="int" />
39
<description>
40
Erase a transition by providing [param from_clip] and [param to_clip] clip indices. [constant CLIP_ANY] can be used for either argument or both.
41
</description>
42
</method>
43
<method name="get_clip_auto_advance" qualifiers="const">
44
<return type="int" enum="AudioStreamInteractive.AutoAdvanceMode" />
45
<param index="0" name="clip_index" type="int" />
46
<description>
47
Return whether a clip has auto-advance enabled. See [method set_clip_auto_advance].
48
</description>
49
</method>
50
<method name="get_clip_auto_advance_next_clip" qualifiers="const">
51
<return type="int" />
52
<param index="0" name="clip_index" type="int" />
53
<description>
54
Return the clip towards which the clip referenced by [param clip_index] will auto-advance to.
55
</description>
56
</method>
57
<method name="get_clip_name" qualifiers="const">
58
<return type="StringName" />
59
<param index="0" name="clip_index" type="int" />
60
<description>
61
Return the name of a clip.
62
</description>
63
</method>
64
<method name="get_clip_stream" qualifiers="const">
65
<return type="AudioStream" />
66
<param index="0" name="clip_index" type="int" />
67
<description>
68
Return the [AudioStream] associated with a clip.
69
</description>
70
</method>
71
<method name="get_transition_fade_beats" qualifiers="const">
72
<return type="float" />
73
<param index="0" name="from_clip" type="int" />
74
<param index="1" name="to_clip" type="int" />
75
<description>
76
Return the time (in beats) for a transition (see [method add_transition]).
77
</description>
78
</method>
79
<method name="get_transition_fade_mode" qualifiers="const">
80
<return type="int" enum="AudioStreamInteractive.FadeMode" />
81
<param index="0" name="from_clip" type="int" />
82
<param index="1" name="to_clip" type="int" />
83
<description>
84
Return the mode for a transition (see [method add_transition]).
85
</description>
86
</method>
87
<method name="get_transition_filler_clip" qualifiers="const">
88
<return type="int" />
89
<param index="0" name="from_clip" type="int" />
90
<param index="1" name="to_clip" type="int" />
91
<description>
92
Return the filler clip for a transition (see [method add_transition]).
93
</description>
94
</method>
95
<method name="get_transition_from_time" qualifiers="const">
96
<return type="int" enum="AudioStreamInteractive.TransitionFromTime" />
97
<param index="0" name="from_clip" type="int" />
98
<param index="1" name="to_clip" type="int" />
99
<description>
100
Return the source time position for a transition (see [method add_transition]).
101
</description>
102
</method>
103
<method name="get_transition_list" qualifiers="const">
104
<return type="PackedInt32Array" />
105
<description>
106
Return the list of transitions (from, to interleaved).
107
</description>
108
</method>
109
<method name="get_transition_to_time" qualifiers="const">
110
<return type="int" enum="AudioStreamInteractive.TransitionToTime" />
111
<param index="0" name="from_clip" type="int" />
112
<param index="1" name="to_clip" type="int" />
113
<description>
114
Return the destination time position for a transition (see [method add_transition]).
115
</description>
116
</method>
117
<method name="has_transition" qualifiers="const">
118
<return type="bool" />
119
<param index="0" name="from_clip" type="int" />
120
<param index="1" name="to_clip" type="int" />
121
<description>
122
Returns [code]true[/code] if a given transition exists (was added via [method add_transition]).
123
</description>
124
</method>
125
<method name="is_transition_holding_previous" qualifiers="const">
126
<return type="bool" />
127
<param index="0" name="from_clip" type="int" />
128
<param index="1" name="to_clip" type="int" />
129
<description>
130
Return whether a transition uses the [i]hold previous[/i] functionality (see [method add_transition]).
131
</description>
132
</method>
133
<method name="is_transition_using_filler_clip" qualifiers="const">
134
<return type="bool" />
135
<param index="0" name="from_clip" type="int" />
136
<param index="1" name="to_clip" type="int" />
137
<description>
138
Return whether a transition uses the [i]filler clip[/i] functionality (see [method add_transition]).
139
</description>
140
</method>
141
<method name="set_clip_auto_advance">
142
<return type="void" />
143
<param index="0" name="clip_index" type="int" />
144
<param index="1" name="mode" type="int" enum="AudioStreamInteractive.AutoAdvanceMode" />
145
<description>
146
Set whether a clip will auto-advance by changing the auto-advance mode.
147
</description>
148
</method>
149
<method name="set_clip_auto_advance_next_clip">
150
<return type="void" />
151
<param index="0" name="clip_index" type="int" />
152
<param index="1" name="auto_advance_next_clip" type="int" />
153
<description>
154
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.
155
</description>
156
</method>
157
<method name="set_clip_name">
158
<return type="void" />
159
<param index="0" name="clip_index" type="int" />
160
<param index="1" name="name" type="StringName" />
161
<description>
162
Set the name of the current clip (for easier identification).
163
</description>
164
</method>
165
<method name="set_clip_stream">
166
<return type="void" />
167
<param index="0" name="clip_index" type="int" />
168
<param index="1" name="stream" type="AudioStream" />
169
<description>
170
Set the [AudioStream] associated with the current clip.
171
</description>
172
</method>
173
</methods>
174
<members>
175
<member name="clip_count" type="int" setter="set_clip_count" getter="get_clip_count" default="0">
176
Amount of clips contained in this interactive player.
177
</member>
178
<member name="initial_clip" type="int" setter="set_initial_clip" getter="get_initial_clip" default="0">
179
Index of the initial clip, which will be played first when this stream is played.
180
</member>
181
</members>
182
<constants>
183
<constant name="TRANSITION_FROM_TIME_IMMEDIATE" value="0" enum="TransitionFromTime">
184
Start transition as soon as possible, don't wait for any specific time position.
185
</constant>
186
<constant name="TRANSITION_FROM_TIME_NEXT_BEAT" value="1" enum="TransitionFromTime">
187
Transition when the clip playback position reaches the next beat.
188
</constant>
189
<constant name="TRANSITION_FROM_TIME_NEXT_BAR" value="2" enum="TransitionFromTime">
190
Transition when the clip playback position reaches the next bar.
191
</constant>
192
<constant name="TRANSITION_FROM_TIME_END" value="3" enum="TransitionFromTime">
193
Transition when the current clip finished playing.
194
</constant>
195
<constant name="TRANSITION_TO_TIME_SAME_POSITION" value="0" enum="TransitionToTime">
196
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.
197
</constant>
198
<constant name="TRANSITION_TO_TIME_START" value="1" enum="TransitionToTime">
199
Transition to the start of the destination clip.
200
</constant>
201
<constant name="FADE_DISABLED" value="0" enum="FadeMode">
202
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.
203
</constant>
204
<constant name="FADE_IN" value="1" enum="FadeMode">
205
Use a fade-in in the next clip, let the current clip finish.
206
</constant>
207
<constant name="FADE_OUT" value="2" enum="FadeMode">
208
Use a fade-out in the current clip, the next clip will start by itself.
209
</constant>
210
<constant name="FADE_CROSS" value="3" enum="FadeMode">
211
Use a cross-fade between clips.
212
</constant>
213
<constant name="FADE_AUTOMATIC" value="4" enum="FadeMode">
214
Use automatic fade logic depending on the transition from/to. It is recommended to use this by default.
215
</constant>
216
<constant name="AUTO_ADVANCE_DISABLED" value="0" enum="AutoAdvanceMode">
217
Disable auto-advance (default).
218
</constant>
219
<constant name="AUTO_ADVANCE_ENABLED" value="1" enum="AutoAdvanceMode">
220
Enable auto-advance, a clip must be specified.
221
</constant>
222
<constant name="AUTO_ADVANCE_RETURN_TO_HOLD" value="2" enum="AutoAdvanceMode">
223
Enable auto-advance, but instead of specifying a clip, the playback will return to hold (see [method add_transition]).
224
</constant>
225
<constant name="CLIP_ANY" value="-1">
226
This constant describes that any clip is valid for a specific transition as either source or destination.
227
</constant>
228
</constants>
229
</class>
230
231