class_audiostreamplayer.rst 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the AudioStreamPlayer.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AudioStreamPlayer:
  6. AudioStreamPlayer
  7. =================
  8. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Plays back audio non-positionally.
  13. Properties
  14. ----------
  15. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  16. | :ref:`bool<class_bool>` | :ref:`autoplay<class_AudioStreamPlayer_property_autoplay>` | false |
  17. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  18. | :ref:`String<class_String>` | :ref:`bus<class_AudioStreamPlayer_property_bus>` | "Master" |
  19. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  20. | :ref:`MixTarget<enum_AudioStreamPlayer_MixTarget>` | :ref:`mix_target<class_AudioStreamPlayer_property_mix_target>` | 0 |
  21. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  22. | :ref:`float<class_float>` | :ref:`pitch_scale<class_AudioStreamPlayer_property_pitch_scale>` | 1.0 |
  23. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  24. | :ref:`bool<class_bool>` | :ref:`playing<class_AudioStreamPlayer_property_playing>` | false |
  25. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  26. | :ref:`AudioStream<class_AudioStream>` | :ref:`stream<class_AudioStreamPlayer_property_stream>` | |
  27. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  28. | :ref:`bool<class_bool>` | :ref:`stream_paused<class_AudioStreamPlayer_property_stream_paused>` | false |
  29. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  30. | :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer_property_volume_db>` | 0.0 |
  31. +----------------------------------------------------+----------------------------------------------------------------------+----------+
  32. Methods
  33. -------
  34. +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayer_method_get_playback_position>` **(** **)** |
  36. +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
  37. | :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` | :ref:`get_stream_playback<class_AudioStreamPlayer_method_get_stream_playback>` **(** **)** |
  38. +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`play<class_AudioStreamPlayer_method_play>` **(** :ref:`float<class_float>` from_position=0.0 **)** |
  40. +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`seek<class_AudioStreamPlayer_method_seek>` **(** :ref:`float<class_float>` to_position **)** |
  42. +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`stop<class_AudioStreamPlayer_method_stop>` **(** **)** |
  44. +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
  45. Signals
  46. -------
  47. .. _class_AudioStreamPlayer_signal_finished:
  48. - **finished** **(** **)**
  49. Emitted when the audio stops playing.
  50. Enumerations
  51. ------------
  52. .. _enum_AudioStreamPlayer_MixTarget:
  53. .. _class_AudioStreamPlayer_constant_MIX_TARGET_STEREO:
  54. .. _class_AudioStreamPlayer_constant_MIX_TARGET_SURROUND:
  55. .. _class_AudioStreamPlayer_constant_MIX_TARGET_CENTER:
  56. enum **MixTarget**:
  57. - **MIX_TARGET_STEREO** = **0** --- The audio will be played only on the first channel.
  58. - **MIX_TARGET_SURROUND** = **1** --- The audio will be played on all surround channels.
  59. - **MIX_TARGET_CENTER** = **2** --- The audio will be played on the second channel, which is usually the center.
  60. Description
  61. -----------
  62. Plays an audio stream non-positionally.
  63. Tutorials
  64. ---------
  65. - :doc:`../tutorials/audio/audio_streams`
  66. Property Descriptions
  67. ---------------------
  68. .. _class_AudioStreamPlayer_property_autoplay:
  69. - :ref:`bool<class_bool>` **autoplay**
  70. +-----------+-----------------------+
  71. | *Default* | false |
  72. +-----------+-----------------------+
  73. | *Setter* | set_autoplay(value) |
  74. +-----------+-----------------------+
  75. | *Getter* | is_autoplay_enabled() |
  76. +-----------+-----------------------+
  77. If ``true``, audio plays when added to scene tree.
  78. ----
  79. .. _class_AudioStreamPlayer_property_bus:
  80. - :ref:`String<class_String>` **bus**
  81. +-----------+----------------+
  82. | *Default* | "Master" |
  83. +-----------+----------------+
  84. | *Setter* | set_bus(value) |
  85. +-----------+----------------+
  86. | *Getter* | get_bus() |
  87. +-----------+----------------+
  88. Bus on which this audio is playing.
  89. ----
  90. .. _class_AudioStreamPlayer_property_mix_target:
  91. - :ref:`MixTarget<enum_AudioStreamPlayer_MixTarget>` **mix_target**
  92. +-----------+-----------------------+
  93. | *Default* | 0 |
  94. +-----------+-----------------------+
  95. | *Setter* | set_mix_target(value) |
  96. +-----------+-----------------------+
  97. | *Getter* | get_mix_target() |
  98. +-----------+-----------------------+
  99. If the audio configuration has more than two speakers, this sets the target channels. See ``MIX_TARGET_*`` constants.
  100. ----
  101. .. _class_AudioStreamPlayer_property_pitch_scale:
  102. - :ref:`float<class_float>` **pitch_scale**
  103. +-----------+------------------------+
  104. | *Default* | 1.0 |
  105. +-----------+------------------------+
  106. | *Setter* | set_pitch_scale(value) |
  107. +-----------+------------------------+
  108. | *Getter* | get_pitch_scale() |
  109. +-----------+------------------------+
  110. Changes the pitch and the tempo of the audio.
  111. ----
  112. .. _class_AudioStreamPlayer_property_playing:
  113. - :ref:`bool<class_bool>` **playing**
  114. +-----------+--------------+
  115. | *Default* | false |
  116. +-----------+--------------+
  117. | *Getter* | is_playing() |
  118. +-----------+--------------+
  119. If ``true``, audio is playing.
  120. ----
  121. .. _class_AudioStreamPlayer_property_stream:
  122. - :ref:`AudioStream<class_AudioStream>` **stream**
  123. +----------+-------------------+
  124. | *Setter* | set_stream(value) |
  125. +----------+-------------------+
  126. | *Getter* | get_stream() |
  127. +----------+-------------------+
  128. The :ref:`AudioStream<class_AudioStream>` object to be played.
  129. ----
  130. .. _class_AudioStreamPlayer_property_stream_paused:
  131. - :ref:`bool<class_bool>` **stream_paused**
  132. +-----------+--------------------------+
  133. | *Default* | false |
  134. +-----------+--------------------------+
  135. | *Setter* | set_stream_paused(value) |
  136. +-----------+--------------------------+
  137. | *Getter* | get_stream_paused() |
  138. +-----------+--------------------------+
  139. ----
  140. .. _class_AudioStreamPlayer_property_volume_db:
  141. - :ref:`float<class_float>` **volume_db**
  142. +-----------+----------------------+
  143. | *Default* | 0.0 |
  144. +-----------+----------------------+
  145. | *Setter* | set_volume_db(value) |
  146. +-----------+----------------------+
  147. | *Getter* | get_volume_db() |
  148. +-----------+----------------------+
  149. Volume of sound, in dB.
  150. Method Descriptions
  151. -------------------
  152. .. _class_AudioStreamPlayer_method_get_playback_position:
  153. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  154. Returns the position in the :ref:`AudioStream<class_AudioStream>` in seconds.
  155. ----
  156. .. _class_AudioStreamPlayer_method_get_stream_playback:
  157. - :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback** **(** **)**
  158. ----
  159. .. _class_AudioStreamPlayer_method_play:
  160. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  161. Plays the audio from the given ``from_position``, in seconds.
  162. ----
  163. .. _class_AudioStreamPlayer_method_seek:
  164. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  165. Sets the position from which audio will be played, in seconds.
  166. ----
  167. .. _class_AudioStreamPlayer_method_stop:
  168. - void **stop** **(** **)**
  169. Stops the audio.