:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamRandomizer.xml. .. _class_AudioStreamRandomizer: AudioStreamRandomizer ===================== **Inherits:** :ref:`AudioStream` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Wraps a pool of audio streams with pitch and volume shifting. Description ----------- Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback. Properties ---------- +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+ | :ref:`PlaybackMode` | :ref:`playback_mode` | ``0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+ | :ref:`float` | :ref:`random_pitch` | ``1.1`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+ | :ref:`float` | :ref:`random_volume_offset_db` | ``5.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+ | :ref:`int` | :ref:`streams_count` | ``0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+ Methods ------- +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_stream` **(** :ref:`int` index **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AudioStream` | :ref:`get_stream` **(** :ref:`int` index **)** |const| | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_stream_probability_weight` **(** :ref:`int` index **)** |const| | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`move_stream` **(** :ref:`int` index_from, :ref:`int` index_to **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_stream` **(** :ref:`int` index **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_stream` **(** :ref:`int` index, :ref:`AudioStream` stream **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_stream_probability_weight` **(** :ref:`int` index, :ref:`float` weight **)** | +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Enumerations ------------ .. _enum_AudioStreamRandomizer_PlaybackMode: .. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM_NO_REPEATS: .. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM: .. _class_AudioStreamRandomizer_constant_PLAYBACK_SEQUENTIAL: enum **PlaybackMode**: - **PLAYBACK_RANDOM_NO_REPEATS** = **0** --- 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. - **PLAYBACK_RANDOM** = **1** --- Pick a stream at random according to the probability weights chosen for each stream. - **PLAYBACK_SEQUENTIAL** = **2** --- Play streams in the order they appear in the stream pool. Property Descriptions --------------------- .. _class_AudioStreamRandomizer_property_playback_mode: - :ref:`PlaybackMode` **playback_mode** +-----------+--------------------------+ | *Default* | ``0`` | +-----------+--------------------------+ | *Setter* | set_playback_mode(value) | +-----------+--------------------------+ | *Getter* | get_playback_mode() | +-----------+--------------------------+ Controls how this AudioStreamRandomizer picks which AudioStream to play next. ---- .. _class_AudioStreamRandomizer_property_random_pitch: - :ref:`float` **random_pitch** +-----------+-------------------------+ | *Default* | ``1.1`` | +-----------+-------------------------+ | *Setter* | set_random_pitch(value) | +-----------+-------------------------+ | *Getter* | get_random_pitch() | +-----------+-------------------------+ The intensity of random pitch variation. A value of 1 means no variation. ---- .. _class_AudioStreamRandomizer_property_random_volume_offset_db: - :ref:`float` **random_volume_offset_db** +-----------+------------------------------------+ | *Default* | ``5.0`` | +-----------+------------------------------------+ | *Setter* | set_random_volume_offset_db(value) | +-----------+------------------------------------+ | *Getter* | get_random_volume_offset_db() | +-----------+------------------------------------+ The intensity of random volume variation. A value of 0 means no variation. ---- .. _class_AudioStreamRandomizer_property_streams_count: - :ref:`int` **streams_count** +-----------+--------------------------+ | *Default* | ``0`` | +-----------+--------------------------+ | *Setter* | set_streams_count(value) | +-----------+--------------------------+ | *Getter* | get_streams_count() | +-----------+--------------------------+ The number of streams in the stream pool. Method Descriptions ------------------- .. _class_AudioStreamRandomizer_method_add_stream: - void **add_stream** **(** :ref:`int` index **)** Insert a stream at the specified index. ---- .. _class_AudioStreamRandomizer_method_get_stream: - :ref:`AudioStream` **get_stream** **(** :ref:`int` index **)** |const| Returns the stream at the specified index. ---- .. _class_AudioStreamRandomizer_method_get_stream_probability_weight: - :ref:`float` **get_stream_probability_weight** **(** :ref:`int` index **)** |const| Returns the probability weight associated with the stream at the given index. ---- .. _class_AudioStreamRandomizer_method_move_stream: - void **move_stream** **(** :ref:`int` index_from, :ref:`int` index_to **)** Move a stream from one index to another. ---- .. _class_AudioStreamRandomizer_method_remove_stream: - void **remove_stream** **(** :ref:`int` index **)** Remove the stream at the specified index. ---- .. _class_AudioStreamRandomizer_method_set_stream: - void **set_stream** **(** :ref:`int` index, :ref:`AudioStream` stream **)** Set the AudioStream at the specified index. ---- .. _class_AudioStreamRandomizer_method_set_stream_probability_weight: - void **set_stream_probability_weight** **(** :ref:`int` index, :ref:`float` weight **)** 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. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`