class_audiostreamplayer.rst 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. .. _class_AudioStreamPlayer_property_bus:
  79. - :ref:`String<class_String>` **bus**
  80. +-----------+----------------+
  81. | *Default* | "Master" |
  82. +-----------+----------------+
  83. | *Setter* | set_bus(value) |
  84. +-----------+----------------+
  85. | *Getter* | get_bus() |
  86. +-----------+----------------+
  87. Bus on which this audio is playing.
  88. .. _class_AudioStreamPlayer_property_mix_target:
  89. - :ref:`MixTarget<enum_AudioStreamPlayer_MixTarget>` **mix_target**
  90. +-----------+-----------------------+
  91. | *Default* | 0 |
  92. +-----------+-----------------------+
  93. | *Setter* | set_mix_target(value) |
  94. +-----------+-----------------------+
  95. | *Getter* | get_mix_target() |
  96. +-----------+-----------------------+
  97. If the audio configuration has more than two speakers, this sets the target channels. See ``MIX_TARGET_*`` constants.
  98. .. _class_AudioStreamPlayer_property_pitch_scale:
  99. - :ref:`float<class_float>` **pitch_scale**
  100. +-----------+------------------------+
  101. | *Default* | 1.0 |
  102. +-----------+------------------------+
  103. | *Setter* | set_pitch_scale(value) |
  104. +-----------+------------------------+
  105. | *Getter* | get_pitch_scale() |
  106. +-----------+------------------------+
  107. Changes the pitch and the tempo of the audio.
  108. .. _class_AudioStreamPlayer_property_playing:
  109. - :ref:`bool<class_bool>` **playing**
  110. +-----------+--------------+
  111. | *Default* | false |
  112. +-----------+--------------+
  113. | *Getter* | is_playing() |
  114. +-----------+--------------+
  115. If ``true``, audio is playing.
  116. .. _class_AudioStreamPlayer_property_stream:
  117. - :ref:`AudioStream<class_AudioStream>` **stream**
  118. +----------+-------------------+
  119. | *Setter* | set_stream(value) |
  120. +----------+-------------------+
  121. | *Getter* | get_stream() |
  122. +----------+-------------------+
  123. The :ref:`AudioStream<class_AudioStream>` object to be played.
  124. .. _class_AudioStreamPlayer_property_stream_paused:
  125. - :ref:`bool<class_bool>` **stream_paused**
  126. +-----------+--------------------------+
  127. | *Default* | false |
  128. +-----------+--------------------------+
  129. | *Setter* | set_stream_paused(value) |
  130. +-----------+--------------------------+
  131. | *Getter* | get_stream_paused() |
  132. +-----------+--------------------------+
  133. .. _class_AudioStreamPlayer_property_volume_db:
  134. - :ref:`float<class_float>` **volume_db**
  135. +-----------+----------------------+
  136. | *Default* | 0.0 |
  137. +-----------+----------------------+
  138. | *Setter* | set_volume_db(value) |
  139. +-----------+----------------------+
  140. | *Getter* | get_volume_db() |
  141. +-----------+----------------------+
  142. Volume of sound, in dB.
  143. Method Descriptions
  144. -------------------
  145. .. _class_AudioStreamPlayer_method_get_playback_position:
  146. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  147. Returns the position in the :ref:`AudioStream<class_AudioStream>` in seconds.
  148. .. _class_AudioStreamPlayer_method_get_stream_playback:
  149. - :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback** **(** **)**
  150. .. _class_AudioStreamPlayer_method_play:
  151. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  152. Plays the audio from the given ``from_position``, in seconds.
  153. .. _class_AudioStreamPlayer_method_seek:
  154. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  155. Sets the position from which audio will be played, in seconds.
  156. .. _class_AudioStreamPlayer_method_stop:
  157. - void **stop** **(** **)**
  158. Stops the audio.