| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AudioStreamPlayback" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Meta class for playing back audio. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Can play, loop, pause a scroll through audio. See [AudioStream] and [AudioStreamOggVorbis] for usage. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Audio Generator Demo">https://godotengine.org/asset-library/asset/2759</link> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="_get_loop_count" qualifiers="virtual const"> |
| 14 | <return type="int" /> |
| 15 | <description> |
| 16 | Overridable method. Should return how many times this audio stream has looped. Most built-in playbacks always return [code]0[/code]. |
| 17 | </description> |
| 18 | </method> |
| 19 | <method name="_get_parameter" qualifiers="virtual const"> |
| 20 | <return type="Variant" /> |
| 21 | <param index="0" name="name" type="StringName" /> |
| 22 | <description> |
| 23 | Return the current value of a playback parameter by name (see [method AudioStream._get_parameter_list]). |
| 24 | </description> |
| 25 | </method> |
| 26 | <method name="_get_playback_position" qualifiers="virtual required const"> |
| 27 | <return type="float" /> |
| 28 | <description> |
| 29 | Overridable method. Should return the current progress along the audio stream, in seconds. |
| 30 | </description> |
| 31 | </method> |
| 32 | <method name="_is_playing" qualifiers="virtual required const"> |
| 33 | <return type="bool" /> |
| 34 | <description> |
| 35 | Overridable method. Should return [code]true[/code] if this playback is active and playing its audio stream. |
| 36 | </description> |
| 37 | </method> |
| 38 | <method name="_mix" qualifiers="virtual required"> |
| 39 | <return type="int" /> |
| 40 | <param index="0" name="buffer" type="AudioFrame*" /> |
| 41 | <param index="1" name="rate_scale" type="float" /> |
| 42 | <param index="2" name="frames" type="int" /> |
| 43 | <description> |
| 44 | Override this method to customize how the audio stream is mixed. This method is called even if the playback is not active. |
| 45 | [b]Note:[/b] It is not useful to override this method in GDScript or C#. Only GDExtension can take advantage of it. |
| 46 | </description> |
| 47 | </method> |
| 48 | <method name="_seek" qualifiers="virtual"> |
| 49 | <return type="void" /> |
| 50 | <param index="0" name="position" type="float" /> |
| 51 | <description> |
| 52 | Override this method to customize what happens when seeking this audio stream at the given [param position], such as by calling [method AudioStreamPlayer.seek]. |
| 53 | </description> |
| 54 | </method> |
| 55 | <method name="_set_parameter" qualifiers="virtual"> |
| 56 | <return type="void" /> |
| 57 | <param index="0" name="name" type="StringName" /> |
| 58 | <param index="1" name="value" type="Variant" /> |
| 59 | <description> |
| 60 | Set the current value of a playback parameter by name (see [method AudioStream._get_parameter_list]). |
| 61 | </description> |
| 62 | </method> |
| 63 | <method name="_start" qualifiers="virtual required"> |
| 64 | <return type="void" /> |
| 65 | <param index="0" name="from_pos" type="float" /> |
| 66 | <description> |
| 67 | Override this method to customize what happens when the playback starts at the given position, such as by calling [method AudioStreamPlayer.play]. |
| 68 | </description> |
| 69 | </method> |
| 70 | <method name="_stop" qualifiers="virtual required"> |
| 71 | <return type="void" /> |
| 72 | <description> |
| 73 | Override this method to customize what happens when the playback is stopped, such as by calling [method AudioStreamPlayer.stop]. |
| 74 | </description> |
| 75 | </method> |
| 76 | <method name="_tag_used_streams" qualifiers="virtual"> |
| 77 | <return type="void" /> |
| 78 | <description> |
| 79 | Overridable method. Called whenever the audio stream is mixed if the playback is active and [method AudioServer.set_enable_tagging_used_audio_streams] has been set to [code]true[/code]. Editor plugins may use this method to "tag" the current position along the audio stream and display it in a preview. |
| 80 | </description> |
| 81 | </method> |
| 82 | <method name="get_loop_count" qualifiers="const"> |
| 83 | <return type="int" /> |
| 84 | <description> |
| 85 | Returns the number of times the stream has looped. |
| 86 | </description> |
| 87 | </method> |
| 88 | <method name="get_playback_position" qualifiers="const"> |
| 89 | <return type="float" /> |
| 90 | <description> |
| 91 | Returns the current position in the stream, in seconds. |
| 92 | </description> |
| 93 | </method> |
| 94 | <method name="get_sample_playback" qualifiers="const" experimental=""> |
| 95 | <return type="AudioSamplePlayback" /> |
| 96 | <description> |
| 97 | Returns the [AudioSamplePlayback] associated with this [AudioStreamPlayback] for playing back the audio sample of this stream. |
| 98 | </description> |
| 99 | </method> |
| 100 | <method name="is_playing" qualifiers="const"> |
| 101 | <return type="bool" /> |
| 102 | <description> |
| 103 | Returns [code]true[/code] if the stream is playing. |
| 104 | </description> |
| 105 | </method> |
| 106 | <method name="mix_audio"> |
| 107 | <return type="PackedVector2Array" /> |
| 108 | <param index="0" name="rate_scale" type="float" /> |
| 109 | <param index="1" name="frames" type="int" /> |
| 110 | <description> |
| 111 | Mixes up to [param frames] of audio from the stream from the current position, at a rate of [param rate_scale], advancing the stream. |
| 112 | Returns a [PackedVector2Array] where each element holds the left and right channel volume levels of each frame. |
| 113 | [b]Note:[/b] Can return fewer frames than requested, make sure to use the size of the return value. |
| 114 | </description> |
| 115 | </method> |
| 116 | <method name="seek"> |
| 117 | <return type="void" /> |
| 118 | <param index="0" name="time" type="float" default="0.0" /> |
| 119 | <description> |
| 120 | Seeks the stream at the given [param time], in seconds. |
| 121 | </description> |
| 122 | </method> |
| 123 | <method name="set_sample_playback" experimental=""> |
| 124 | <return type="void" /> |
| 125 | <param index="0" name="playback_sample" type="AudioSamplePlayback" /> |
| 126 | <description> |
| 127 | Associates [AudioSamplePlayback] to this [AudioStreamPlayback] for playing back the audio sample of this stream. |
| 128 | </description> |
| 129 | </method> |
| 130 | <method name="start"> |
| 131 | <return type="void" /> |
| 132 | <param index="0" name="from_pos" type="float" default="0.0" /> |
| 133 | <description> |
| 134 | Starts the stream from the given [param from_pos], in seconds. |
| 135 | </description> |
| 136 | </method> |
| 137 | <method name="stop"> |
| 138 | <return type="void" /> |
| 139 | <description> |
| 140 | Stops the stream. |
| 141 | </description> |
| 142 | </method> |
| 143 | </methods> |
| 144 | </class> |