class_audiostreamrandomizer.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamRandomizer.xml.
  6. .. _class_AudioStreamRandomizer:
  7. AudioStreamRandomizer
  8. =====================
  9. **Inherits:** :ref:`AudioStream<class_AudioStream>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Wraps a pool of audio streams with pitch and volume shifting.
  11. Description
  12. -----------
  13. Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback.
  14. Properties
  15. ----------
  16. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  17. | :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` | :ref:`playback_mode<class_AudioStreamRandomizer_property_playback_mode>` | ``0`` |
  18. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  19. | :ref:`float<class_float>` | :ref:`random_pitch<class_AudioStreamRandomizer_property_random_pitch>` | ``1.1`` |
  20. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  21. | :ref:`float<class_float>` | :ref:`random_volume_offset_db<class_AudioStreamRandomizer_property_random_volume_offset_db>` | ``5.0`` |
  22. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  23. | :ref:`int<class_int>` | :ref:`streams_count<class_AudioStreamRandomizer_property_streams_count>` | ``0`` |
  24. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  25. Methods
  26. -------
  27. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`add_stream<class_AudioStreamRandomizer_method_add_stream>` **(** :ref:`int<class_int>` index **)** |
  29. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`AudioStream<class_AudioStream>` | :ref:`get_stream<class_AudioStreamRandomizer_method_get_stream>` **(** :ref:`int<class_int>` index **)** |const| |
  31. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`float<class_float>` | :ref:`get_stream_probability_weight<class_AudioStreamRandomizer_method_get_stream_probability_weight>` **(** :ref:`int<class_int>` index **)** |const| |
  33. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`move_stream<class_AudioStreamRandomizer_method_move_stream>` **(** :ref:`int<class_int>` index_from, :ref:`int<class_int>` index_to **)** |
  35. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`remove_stream<class_AudioStreamRandomizer_method_remove_stream>` **(** :ref:`int<class_int>` index **)** |
  37. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_stream<class_AudioStreamRandomizer_method_set_stream>` **(** :ref:`int<class_int>` index, :ref:`AudioStream<class_AudioStream>` stream **)** |
  39. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_stream_probability_weight<class_AudioStreamRandomizer_method_set_stream_probability_weight>` **(** :ref:`int<class_int>` index, :ref:`float<class_float>` weight **)** |
  41. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. Enumerations
  43. ------------
  44. .. _enum_AudioStreamRandomizer_PlaybackMode:
  45. .. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM_NO_REPEATS:
  46. .. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM:
  47. .. _class_AudioStreamRandomizer_constant_PLAYBACK_SEQUENTIAL:
  48. enum **PlaybackMode**:
  49. - **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.
  50. - **PLAYBACK_RANDOM** = **1** --- Pick a stream at random according to the probability weights chosen for each stream.
  51. - **PLAYBACK_SEQUENTIAL** = **2** --- Play streams in the order they appear in the stream pool.
  52. Property Descriptions
  53. ---------------------
  54. .. _class_AudioStreamRandomizer_property_playback_mode:
  55. - :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **playback_mode**
  56. +-----------+--------------------------+
  57. | *Default* | ``0`` |
  58. +-----------+--------------------------+
  59. | *Setter* | set_playback_mode(value) |
  60. +-----------+--------------------------+
  61. | *Getter* | get_playback_mode() |
  62. +-----------+--------------------------+
  63. Controls how this AudioStreamRandomizer picks which AudioStream to play next.
  64. ----
  65. .. _class_AudioStreamRandomizer_property_random_pitch:
  66. - :ref:`float<class_float>` **random_pitch**
  67. +-----------+-------------------------+
  68. | *Default* | ``1.1`` |
  69. +-----------+-------------------------+
  70. | *Setter* | set_random_pitch(value) |
  71. +-----------+-------------------------+
  72. | *Getter* | get_random_pitch() |
  73. +-----------+-------------------------+
  74. The intensity of random pitch variation. A value of 1 means no variation.
  75. ----
  76. .. _class_AudioStreamRandomizer_property_random_volume_offset_db:
  77. - :ref:`float<class_float>` **random_volume_offset_db**
  78. +-----------+------------------------------------+
  79. | *Default* | ``5.0`` |
  80. +-----------+------------------------------------+
  81. | *Setter* | set_random_volume_offset_db(value) |
  82. +-----------+------------------------------------+
  83. | *Getter* | get_random_volume_offset_db() |
  84. +-----------+------------------------------------+
  85. The intensity of random volume variation. A value of 0 means no variation.
  86. ----
  87. .. _class_AudioStreamRandomizer_property_streams_count:
  88. - :ref:`int<class_int>` **streams_count**
  89. +-----------+--------------------------+
  90. | *Default* | ``0`` |
  91. +-----------+--------------------------+
  92. | *Setter* | set_streams_count(value) |
  93. +-----------+--------------------------+
  94. | *Getter* | get_streams_count() |
  95. +-----------+--------------------------+
  96. The number of streams in the stream pool.
  97. Method Descriptions
  98. -------------------
  99. .. _class_AudioStreamRandomizer_method_add_stream:
  100. - void **add_stream** **(** :ref:`int<class_int>` index **)**
  101. Insert a stream at the specified index.
  102. ----
  103. .. _class_AudioStreamRandomizer_method_get_stream:
  104. - :ref:`AudioStream<class_AudioStream>` **get_stream** **(** :ref:`int<class_int>` index **)** |const|
  105. Returns the stream at the specified index.
  106. ----
  107. .. _class_AudioStreamRandomizer_method_get_stream_probability_weight:
  108. - :ref:`float<class_float>` **get_stream_probability_weight** **(** :ref:`int<class_int>` index **)** |const|
  109. Returns the probability weight associated with the stream at the given index.
  110. ----
  111. .. _class_AudioStreamRandomizer_method_move_stream:
  112. - void **move_stream** **(** :ref:`int<class_int>` index_from, :ref:`int<class_int>` index_to **)**
  113. Move a stream from one index to another.
  114. ----
  115. .. _class_AudioStreamRandomizer_method_remove_stream:
  116. - void **remove_stream** **(** :ref:`int<class_int>` index **)**
  117. Remove the stream at the specified index.
  118. ----
  119. .. _class_AudioStreamRandomizer_method_set_stream:
  120. - void **set_stream** **(** :ref:`int<class_int>` index, :ref:`AudioStream<class_AudioStream>` stream **)**
  121. Set the AudioStream at the specified index.
  122. ----
  123. .. _class_AudioStreamRandomizer_method_set_stream_probability_weight:
  124. - void **set_stream_probability_weight** **(** :ref:`int<class_int>` index, :ref:`float<class_float>` weight **)**
  125. 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.
  126. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  127. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  128. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  129. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  130. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  131. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`