class_audiostreamplayer.rst 7.7 KB

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