0.2.0-dev Download ZIP
106 lines ·5.6 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="AudioStreamRandomizer" inherits="AudioStream" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Wraps a pool of audio streams with pitch and volume shifting. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Audio streams">$DOCS_URL/tutorials/audio/audio_streams.html</link> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="add_stream"> |
| 14 | <return type="void" /> |
| 15 | <param index="0" name="index" type="int" /> |
| 16 | <param index="1" name="stream" type="AudioStream" /> |
| 17 | <param index="2" name="weight" type="float" default="1.0" /> |
| 18 | <description> |
| 19 | Insert a stream at the specified index. If the index is less than zero, the insertion occurs at the end of the underlying pool. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="get_stream" qualifiers="const"> |
| 23 | <return type="AudioStream" /> |
| 24 | <param index="0" name="index" type="int" /> |
| 25 | <description> |
| 26 | Returns the stream at the specified index. |
| 27 | </description> |
| 28 | </method> |
| 29 | <method name="get_stream_probability_weight" qualifiers="const"> |
| 30 | <return type="float" /> |
| 31 | <param index="0" name="index" type="int" /> |
| 32 | <description> |
| 33 | Returns the probability weight associated with the stream at the given index. |
| 34 | </description> |
| 35 | </method> |
| 36 | <method name="move_stream"> |
| 37 | <return type="void" /> |
| 38 | <param index="0" name="index_from" type="int" /> |
| 39 | <param index="1" name="index_to" type="int" /> |
| 40 | <description> |
| 41 | Move a stream from one index to another. |
| 42 | </description> |
| 43 | </method> |
| 44 | <method name="remove_stream"> |
| 45 | <return type="void" /> |
| 46 | <param index="0" name="index" type="int" /> |
| 47 | <description> |
| 48 | Remove the stream at the specified index. |
| 49 | </description> |
| 50 | </method> |
| 51 | <method name="set_stream"> |
| 52 | <return type="void" /> |
| 53 | <param index="0" name="index" type="int" /> |
| 54 | <param index="1" name="stream" type="AudioStream" /> |
| 55 | <description> |
| 56 | Set the AudioStream at the specified index. |
| 57 | </description> |
| 58 | </method> |
| 59 | <method name="set_stream_probability_weight"> |
| 60 | <return type="void" /> |
| 61 | <param index="0" name="index" type="int" /> |
| 62 | <param index="1" name="weight" type="float" /> |
| 63 | <description> |
| 64 | Set the probability weight of the stream at the specified index. The higher this value, the more likely that the randomizer will choose this stream during random playback modes. |
| 65 | </description> |
| 66 | </method> |
| 67 | </methods> |
| 68 | <members> |
| 69 | <member name="playback_mode" type="int" setter="set_playback_mode" getter="get_playback_mode" enum="AudioStreamRandomizer.PlaybackMode" default="0"> |
| 70 | Controls how this AudioStreamRandomizer picks which AudioStream to play next. |
| 71 | </member> |
| 72 | <member name="random_pitch" type="float" setter="set_random_pitch" getter="get_random_pitch" default="1.0"> |
| 73 | The largest possible frequency multiplier of the random pitch variation. Pitch will be randomly chosen within a range of [code skip-lint]1.0 / random_pitch[/code] and [code skip-lint]random_pitch[/code]. A value of [code]1.0[/code] means no variation. A value of [code]2.0[/code] means pitch will be randomized between double and half. |
| 74 | [b]Note:[/b] Setting this property also sets [member random_pitch_semitones]. |
| 75 | </member> |
| 76 | <member name="random_pitch_semitones" type="float" setter="set_random_pitch_semitones" getter="get_random_pitch_semitones" default="0.0"> |
| 77 | The largest possible distance, in semitones, of the random pitch variation. A value of [code]0.0[/code] means no variation. |
| 78 | [b]Note:[/b] Setting this property also sets [member random_pitch]. |
| 79 | </member> |
| 80 | <member name="random_volume_offset_db" type="float" setter="set_random_volume_offset_db" getter="get_random_volume_offset_db" default="0.0"> |
| 81 | The intensity of random volume variation. Volume will be increased or decreased by a random value up to [code skip-lint]random_volume_offset_db[/code]. A value of [code]0.0[/code] means no variation. A value of [code]3.0[/code] means volume will be randomized between [code]-3.0 dB[/code] and [code]+3.0 dB[/code]. |
| 82 | </member> |
| 83 | <member name="stream_{index}/stream" type="AudioStream" setter="" getter=""> |
| 84 | The [AudioStream] at [code]index[/code]. |
| 85 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. streams_count - 1[/code] range. |
| 86 | </member> |
| 87 | <member name="stream_{index}/weight" type="float" setter="" getter="" default="1.0"> |
| 88 | The probability weight of the [AudioStream] at [code]index[/code]. |
| 89 | [b]Note:[/b] [code]index[/code] is a value in the [code]0 .. streams_count - 1[/code] range. |
| 90 | </member> |
| 91 | <member name="streams_count" type="int" setter="set_streams_count" getter="get_streams_count" default="0"> |
| 92 | The number of streams in the stream pool. |
| 93 | </member> |
| 94 | </members> |
| 95 | <constants> |
| 96 | <constant name="PLAYBACK_RANDOM_NO_REPEATS" value="0" enum="PlaybackMode"> |
| 97 | Pick a stream at random according to the probability weights chosen for each stream, but avoid playing the same stream twice in a row whenever possible. If only 1 sound is present in the pool, the same sound will always play, effectively allowing repeats to occur. |
| 98 | </constant> |
| 99 | <constant name="PLAYBACK_RANDOM" value="1" enum="PlaybackMode"> |
| 100 | Pick a stream at random according to the probability weights chosen for each stream. If only 1 sound is present in the pool, the same sound will always play. |
| 101 | </constant> |
| 102 | <constant name="PLAYBACK_SEQUENTIAL" value="2" enum="PlaybackMode"> |
| 103 | Play streams in the order they appear in the stream pool. If only 1 sound is present in the pool, the same sound will always play. |
| 104 | </constant> |
| 105 | </constants> |
| 106 | </class> |