mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
273 lines
12 KiB
ReStructuredText
273 lines
12 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/AudioStreamRandomizer.xml.
|
|
|
|
.. _class_AudioStreamRandomizer:
|
|
|
|
AudioStreamRandomizer
|
|
=====================
|
|
|
|
**Inherits:** :ref:`AudioStream<class_AudioStream>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Wraps a pool of audio streams with pitch and volume shifting.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` | :ref:`playback_mode<class_AudioStreamRandomizer_property_playback_mode>` | ``0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`random_pitch<class_AudioStreamRandomizer_property_random_pitch>` | ``1.1`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`random_volume_offset_db<class_AudioStreamRandomizer_property_random_volume_offset_db>` | ``5.0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`int<class_int>` | :ref:`streams_count<class_AudioStreamRandomizer_property_streams_count>` | ``0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`add_stream<class_AudioStreamRandomizer_method_add_stream>` **(** :ref:`int<class_int>` index, :ref:`AudioStream<class_AudioStream>` stream, :ref:`float<class_float>` weight=1.0 **)** |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`AudioStream<class_AudioStream>` | :ref:`get_stream<class_AudioStreamRandomizer_method_get_stream>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_stream_probability_weight<class_AudioStreamRandomizer_method_get_stream_probability_weight>` **(** :ref:`int<class_int>` index **)** |const| |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`move_stream<class_AudioStreamRandomizer_method_move_stream>` **(** :ref:`int<class_int>` index_from, :ref:`int<class_int>` index_to **)** |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`remove_stream<class_AudioStreamRandomizer_method_remove_stream>` **(** :ref:`int<class_int>` index **)** |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_stream<class_AudioStreamRandomizer_method_set_stream>` **(** :ref:`int<class_int>` index, :ref:`AudioStream<class_AudioStream>` stream **)** |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_stream_probability_weight<class_AudioStreamRandomizer_method_set_stream_probability_weight>` **(** :ref:`int<class_int>` index, :ref:`float<class_float>` weight **)** |
|
|
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_AudioStreamRandomizer_PlaybackMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **PlaybackMode**:
|
|
|
|
.. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM_NO_REPEATS:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_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. If only 1 sound is present in the pool, the same sound will always play, effectively allowing repeats to occur.
|
|
|
|
.. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **PLAYBACK_RANDOM** = ``1``
|
|
|
|
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.
|
|
|
|
.. _class_AudioStreamRandomizer_constant_PLAYBACK_SEQUENTIAL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **PLAYBACK_SEQUENTIAL** = ``2``
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_AudioStreamRandomizer_property_playback_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **playback_mode** = ``0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_playback_mode** **(** :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` value **)**
|
|
- :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **get_playback_mode** **(** **)**
|
|
|
|
Controls how this AudioStreamRandomizer picks which AudioStream to play next.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_random_pitch:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **random_pitch** = ``1.1``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_random_pitch** **(** :ref:`float<class_float>` value **)**
|
|
- :ref:`float<class_float>` **get_random_pitch** **(** **)**
|
|
|
|
The intensity of random pitch variation. A value of 1 means no variation.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_random_volume_offset_db:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **random_volume_offset_db** = ``5.0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_random_volume_offset_db** **(** :ref:`float<class_float>` value **)**
|
|
- :ref:`float<class_float>` **get_random_volume_offset_db** **(** **)**
|
|
|
|
The intensity of random volume variation. A value of 0 means no variation.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_streams_count:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **streams_count** = ``0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_streams_count** **(** :ref:`int<class_int>` value **)**
|
|
- :ref:`int<class_int>` **get_streams_count** **(** **)**
|
|
|
|
The number of streams in the stream pool.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_AudioStreamRandomizer_method_add_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **add_stream** **(** :ref:`int<class_int>` index, :ref:`AudioStream<class_AudioStream>` stream, :ref:`float<class_float>` weight=1.0 **)**
|
|
|
|
Insert a stream at the specified index. If the index is less than zero, the insertion occurs at the end of the underlying pool.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_get_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`AudioStream<class_AudioStream>` **get_stream** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the stream at the specified index.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_get_stream_probability_weight:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`float<class_float>` **get_stream_probability_weight** **(** :ref:`int<class_int>` index **)** |const|
|
|
|
|
Returns the probability weight associated with the stream at the given index.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_move_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **move_stream** **(** :ref:`int<class_int>` index_from, :ref:`int<class_int>` index_to **)**
|
|
|
|
Move a stream from one index to another.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_remove_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **remove_stream** **(** :ref:`int<class_int>` index **)**
|
|
|
|
Remove the stream at the specified index.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_set_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **set_stream** **(** :ref:`int<class_int>` index, :ref:`AudioStream<class_AudioStream>` stream **)**
|
|
|
|
Set the AudioStream at the specified index.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_set_stream_probability_weight:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **set_stream_probability_weight** **(** :ref:`int<class_int>` index, :ref:`float<class_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.)`
|