0.2.0-dev Download ZIP
123 lines ·6.2 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AudioStream" inherits="Resource" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Base class for audio streams. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Base class for audio streams. Audio streams are used for sound effects and music playback, and support WAV (via [AudioStreamWAV]), Ogg (via [AudioStreamOggVorbis]), and MP3 (via [AudioStreamMP3]) file formats. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Audio streams">$DOCS_URL/tutorials/audio/audio_streams.html</link> |
| 11 | <link title="Audio Generator Demo">https://godotengine.org/asset-library/asset/2759</link> |
| 12 | <link title="Audio Microphone Record Demo">https://godotengine.org/asset-library/asset/2760</link> |
| 13 | <link title="Audio Spectrum Visualizer Demo">https://godotengine.org/asset-library/asset/2762</link> |
| 14 | </tutorials> |
| 15 | <methods> |
| 16 | <method name="_get_bar_beats" qualifiers="virtual const"> |
| 17 | <return type="int" /> |
| 18 | <description> |
| 19 | Override this method to return the bar beats of this stream. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="_get_beat_count" qualifiers="virtual const"> |
| 23 | <return type="int" /> |
| 24 | <description> |
| 25 | Overridable method. Should return the total number of beats of this audio stream. Used by the engine to determine the position of every beat. |
| 26 | Ideally, the returned value should be based off the stream's sample rate ([member AudioStreamWAV.mix_rate], for example). |
| 27 | </description> |
| 28 | </method> |
| 29 | <method name="_get_bpm" qualifiers="virtual const"> |
| 30 | <return type="float" /> |
| 31 | <description> |
| 32 | Overridable method. Should return the tempo of this audio stream, in beats per minute (BPM). Used by the engine to determine the position of every beat. |
| 33 | Ideally, the returned value should be based off the stream's sample rate ([member AudioStreamWAV.mix_rate], for example). |
| 34 | </description> |
| 35 | </method> |
| 36 | <method name="_get_length" qualifiers="virtual const"> |
| 37 | <return type="float" /> |
| 38 | <description> |
| 39 | Override this method to customize the returned value of [method get_length]. Should return the length of this audio stream, in seconds. |
| 40 | </description> |
| 41 | </method> |
| 42 | <method name="_get_parameter_list" qualifiers="virtual const"> |
| 43 | <return type="Dictionary[]" /> |
| 44 | <description> |
| 45 | Return the controllable parameters of this stream. This array contains dictionaries with a property info description format (see [method Object.get_property_list]). Additionally, the default value for this parameter must be added tho each dictionary in "default_value" field. |
| 46 | </description> |
| 47 | </method> |
| 48 | <method name="_get_stream_name" qualifiers="virtual const" deprecated="This method is not used by the engine."> |
| 49 | <return type="String" /> |
| 50 | <description> |
| 51 | Override this method to customize the name assigned to this audio stream. |
| 52 | </description> |
| 53 | </method> |
| 54 | <method name="_get_tags" qualifiers="virtual const"> |
| 55 | <return type="Dictionary" /> |
| 56 | <description> |
| 57 | Override this method to customize the tags for this audio stream. Should return a [Dictionary] of strings with the tag as the key and its content as the value. |
| 58 | Commonly used tags include [code]title[/code], [code]artist[/code], [code]album[/code], [code]tracknumber[/code], and [code]date[/code]. |
| 59 | </description> |
| 60 | </method> |
| 61 | <method name="_has_loop" qualifiers="virtual const"> |
| 62 | <return type="bool" /> |
| 63 | <description> |
| 64 | Override this method to return [code]true[/code] if this stream has a loop. |
| 65 | </description> |
| 66 | </method> |
| 67 | <method name="_instantiate_playback" qualifiers="virtual required const"> |
| 68 | <return type="AudioStreamPlayback" /> |
| 69 | <description> |
| 70 | Override this method to customize the returned value of [method instantiate_playback]. Should return a new [AudioStreamPlayback] created when the stream is played (such as by an [AudioStreamPlayer]). |
| 71 | </description> |
| 72 | </method> |
| 73 | <method name="_is_monophonic" qualifiers="virtual const"> |
| 74 | <return type="bool" /> |
| 75 | <description> |
| 76 | Override this method to customize the returned value of [method is_monophonic]. Should return [code]true[/code] if this audio stream only supports one channel. |
| 77 | </description> |
| 78 | </method> |
| 79 | <method name="can_be_sampled" qualifiers="const" experimental=""> |
| 80 | <return type="bool" /> |
| 81 | <description> |
| 82 | Returns if the current [AudioStream] can be used as a sample. Only static streams can be sampled. |
| 83 | </description> |
| 84 | </method> |
| 85 | <method name="generate_sample" qualifiers="const" experimental=""> |
| 86 | <return type="AudioSample" /> |
| 87 | <description> |
| 88 | Generates an [AudioSample] based on the current stream. |
| 89 | </description> |
| 90 | </method> |
| 91 | <method name="get_length" qualifiers="const"> |
| 92 | <return type="float" /> |
| 93 | <description> |
| 94 | Returns the length of the audio stream in seconds. If this stream is an [AudioStreamRandomizer], returns the length of the last played stream. If this stream has an indefinite length (such as for [AudioStreamGenerator] and [AudioStreamMicrophone]), returns [code]0.0[/code]. |
| 95 | </description> |
| 96 | </method> |
| 97 | <method name="instantiate_playback"> |
| 98 | <return type="AudioStreamPlayback" /> |
| 99 | <description> |
| 100 | Returns a newly created [AudioStreamPlayback] intended to play this audio stream. Useful for when you want to extend [method _instantiate_playback] but call [method instantiate_playback] from an internally held AudioStream subresource. An example of this can be found in the source code for [code]AudioStreamRandomPitch::instantiate_playback[/code]. |
| 101 | </description> |
| 102 | </method> |
| 103 | <method name="is_meta_stream" qualifiers="const"> |
| 104 | <return type="bool" /> |
| 105 | <description> |
| 106 | Returns [code]true[/code] if the stream is a collection of other streams, [code]false[/code] otherwise. |
| 107 | </description> |
| 108 | </method> |
| 109 | <method name="is_monophonic" qualifiers="const"> |
| 110 | <return type="bool" /> |
| 111 | <description> |
| 112 | Returns [code]true[/code] if this audio stream only supports one channel ([i]monophony[/i]), or [code]false[/code] if the audio stream supports two or more channels ([i]polyphony[/i]). |
| 113 | </description> |
| 114 | </method> |
| 115 | </methods> |
| 116 | <signals> |
| 117 | <signal name="parameter_list_changed"> |
| 118 | <description> |
| 119 | Signal to be emitted to notify when the parameter list changed. |
| 120 | </description> |
| 121 | </signal> |
| 122 | </signals> |
| 123 | </class> |