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