class_audiostreamrandomizer.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  21. | :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` | :ref:`playback_mode<class_AudioStreamRandomizer_property_playback_mode>` | ``0`` |
  22. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  23. | :ref:`float<class_float>` | :ref:`random_pitch<class_AudioStreamRandomizer_property_random_pitch>` | ``1.0`` |
  24. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  25. | :ref:`float<class_float>` | :ref:`random_pitch_semitones<class_AudioStreamRandomizer_property_random_pitch_semitones>` | ``0.0`` |
  26. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  27. | :ref:`float<class_float>` | :ref:`random_volume_offset_db<class_AudioStreamRandomizer_property_random_volume_offset_db>` | ``0.0`` |
  28. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  29. | :ref:`int<class_int>` | :ref:`streams_count<class_AudioStreamRandomizer_property_streams_count>` | ``0`` |
  30. +--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
  31. .. rst-class:: classref-reftable-group
  32. Methods
  33. -------
  34. .. table::
  35. :widths: auto
  36. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | |void| | :ref:`add_stream<class_AudioStreamRandomizer_method_add_stream>`\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`, weight\: :ref:`float<class_float>` = 1.0\ ) |
  38. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`AudioStream<class_AudioStream>` | :ref:`get_stream<class_AudioStreamRandomizer_method_get_stream>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  40. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`float<class_float>` | :ref:`get_stream_probability_weight<class_AudioStreamRandomizer_method_get_stream_probability_weight>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  42. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | |void| | :ref:`move_stream<class_AudioStreamRandomizer_method_move_stream>`\ (\ index_from\: :ref:`int<class_int>`, index_to\: :ref:`int<class_int>`\ ) |
  44. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`remove_stream<class_AudioStreamRandomizer_method_remove_stream>`\ (\ index\: :ref:`int<class_int>`\ ) |
  46. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | |void| | :ref:`set_stream<class_AudioStreamRandomizer_method_set_stream>`\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`\ ) |
  48. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | |void| | :ref:`set_stream_probability_weight<class_AudioStreamRandomizer_method_set_stream_probability_weight>`\ (\ index\: :ref:`int<class_int>`, weight\: :ref:`float<class_float>`\ ) |
  50. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. .. rst-class:: classref-section-separator
  52. ----
  53. .. rst-class:: classref-descriptions-group
  54. Enumerations
  55. ------------
  56. .. _enum_AudioStreamRandomizer_PlaybackMode:
  57. .. rst-class:: classref-enumeration
  58. enum **PlaybackMode**: :ref:`🔗<enum_AudioStreamRandomizer_PlaybackMode>`
  59. .. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM_NO_REPEATS:
  60. .. rst-class:: classref-enumeration-constant
  61. :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **PLAYBACK_RANDOM_NO_REPEATS** = ``0``
  62. 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.
  63. .. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM:
  64. .. rst-class:: classref-enumeration-constant
  65. :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **PLAYBACK_RANDOM** = ``1``
  66. 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.
  67. .. _class_AudioStreamRandomizer_constant_PLAYBACK_SEQUENTIAL:
  68. .. rst-class:: classref-enumeration-constant
  69. :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **PLAYBACK_SEQUENTIAL** = ``2``
  70. 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.
  71. .. rst-class:: classref-section-separator
  72. ----
  73. .. rst-class:: classref-descriptions-group
  74. Property Descriptions
  75. ---------------------
  76. .. _class_AudioStreamRandomizer_property_playback_mode:
  77. .. rst-class:: classref-property
  78. :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **playback_mode** = ``0`` :ref:`🔗<class_AudioStreamRandomizer_property_playback_mode>`
  79. .. rst-class:: classref-property-setget
  80. - |void| **set_playback_mode**\ (\ value\: :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>`\ )
  81. - :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **get_playback_mode**\ (\ )
  82. Controls how this AudioStreamRandomizer picks which AudioStream to play next.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_AudioStreamRandomizer_property_random_pitch:
  86. .. rst-class:: classref-property
  87. :ref:`float<class_float>` **random_pitch** = ``1.0`` :ref:`🔗<class_AudioStreamRandomizer_property_random_pitch>`
  88. .. rst-class:: classref-property-setget
  89. - |void| **set_random_pitch**\ (\ value\: :ref:`float<class_float>`\ )
  90. - :ref:`float<class_float>` **get_random_pitch**\ (\ )
  91. The largest possible frequency multiplier of the random pitch variation. A value of ``1.0`` means no variation.
  92. \ **Note:** Setting this property also sets :ref:`random_pitch_semitones<class_AudioStreamRandomizer_property_random_pitch_semitones>`.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_AudioStreamRandomizer_property_random_pitch_semitones:
  96. .. rst-class:: classref-property
  97. :ref:`float<class_float>` **random_pitch_semitones** = ``0.0`` :ref:`🔗<class_AudioStreamRandomizer_property_random_pitch_semitones>`
  98. .. rst-class:: classref-property-setget
  99. - |void| **set_random_pitch_semitones**\ (\ value\: :ref:`float<class_float>`\ )
  100. - :ref:`float<class_float>` **get_random_pitch_semitones**\ (\ )
  101. The largest possible distance, in semitones, of the random pitch variation. A value of ``0.0`` means no variation.
  102. \ **Note:** Setting this property also sets :ref:`random_pitch<class_AudioStreamRandomizer_property_random_pitch>`.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_AudioStreamRandomizer_property_random_volume_offset_db:
  106. .. rst-class:: classref-property
  107. :ref:`float<class_float>` **random_volume_offset_db** = ``0.0`` :ref:`🔗<class_AudioStreamRandomizer_property_random_volume_offset_db>`
  108. .. rst-class:: classref-property-setget
  109. - |void| **set_random_volume_offset_db**\ (\ value\: :ref:`float<class_float>`\ )
  110. - :ref:`float<class_float>` **get_random_volume_offset_db**\ (\ )
  111. The intensity of random volume variation. A value of 0 means no variation.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_AudioStreamRandomizer_property_streams_count:
  115. .. rst-class:: classref-property
  116. :ref:`int<class_int>` **streams_count** = ``0`` :ref:`🔗<class_AudioStreamRandomizer_property_streams_count>`
  117. .. rst-class:: classref-property-setget
  118. - |void| **set_streams_count**\ (\ value\: :ref:`int<class_int>`\ )
  119. - :ref:`int<class_int>` **get_streams_count**\ (\ )
  120. The number of streams in the stream pool.
  121. .. rst-class:: classref-section-separator
  122. ----
  123. .. rst-class:: classref-descriptions-group
  124. Method Descriptions
  125. -------------------
  126. .. _class_AudioStreamRandomizer_method_add_stream:
  127. .. rst-class:: classref-method
  128. |void| **add_stream**\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`, weight\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_AudioStreamRandomizer_method_add_stream>`
  129. Insert a stream at the specified index. If the index is less than zero, the insertion occurs at the end of the underlying pool.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_AudioStreamRandomizer_method_get_stream:
  133. .. rst-class:: classref-method
  134. :ref:`AudioStream<class_AudioStream>` **get_stream**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioStreamRandomizer_method_get_stream>`
  135. Returns the stream at the specified index.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_AudioStreamRandomizer_method_get_stream_probability_weight:
  139. .. rst-class:: classref-method
  140. :ref:`float<class_float>` **get_stream_probability_weight**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioStreamRandomizer_method_get_stream_probability_weight>`
  141. Returns the probability weight associated with the stream at the given index.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_AudioStreamRandomizer_method_move_stream:
  145. .. rst-class:: classref-method
  146. |void| **move_stream**\ (\ index_from\: :ref:`int<class_int>`, index_to\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_move_stream>`
  147. Move a stream from one index to another.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_AudioStreamRandomizer_method_remove_stream:
  151. .. rst-class:: classref-method
  152. |void| **remove_stream**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_remove_stream>`
  153. Remove the stream at the specified index.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_AudioStreamRandomizer_method_set_stream:
  157. .. rst-class:: classref-method
  158. |void| **set_stream**\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_set_stream>`
  159. Set the AudioStream at the specified index.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_AudioStreamRandomizer_method_set_stream_probability_weight:
  163. .. rst-class:: classref-method
  164. |void| **set_stream_probability_weight**\ (\ index\: :ref:`int<class_int>`, weight\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_set_stream_probability_weight>`
  165. 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.
  166. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  167. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  168. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  169. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  170. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  171. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  172. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  173. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  174. .. |void| replace:: :abbr:`void (No return value.)`