class_audiostreamplayer2d.rst 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the AudioStreamPlayer2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_AudioStreamPlayer2D:
  5. AudioStreamPlayer2D
  6. ===================
  7. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Plays audio in 2D.
  12. Properties
  13. ----------
  14. +---------------------------------------+------------------------------------------------------------------------+
  15. | :ref:`int<class_int>` | :ref:`area_mask<class_AudioStreamPlayer2D_property_area_mask>` |
  16. +---------------------------------------+------------------------------------------------------------------------+
  17. | :ref:`float<class_float>` | :ref:`attenuation<class_AudioStreamPlayer2D_property_attenuation>` |
  18. +---------------------------------------+------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`autoplay<class_AudioStreamPlayer2D_property_autoplay>` |
  20. +---------------------------------------+------------------------------------------------------------------------+
  21. | :ref:`String<class_String>` | :ref:`bus<class_AudioStreamPlayer2D_property_bus>` |
  22. +---------------------------------------+------------------------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`max_distance<class_AudioStreamPlayer2D_property_max_distance>` |
  24. +---------------------------------------+------------------------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`pitch_scale<class_AudioStreamPlayer2D_property_pitch_scale>` |
  26. +---------------------------------------+------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`playing<class_AudioStreamPlayer2D_property_playing>` |
  28. +---------------------------------------+------------------------------------------------------------------------+
  29. | :ref:`AudioStream<class_AudioStream>` | :ref:`stream<class_AudioStreamPlayer2D_property_stream>` |
  30. +---------------------------------------+------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`stream_paused<class_AudioStreamPlayer2D_property_stream_paused>` |
  32. +---------------------------------------+------------------------------------------------------------------------+
  33. | :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer2D_property_volume_db>` |
  34. +---------------------------------------+------------------------------------------------------------------------+
  35. Methods
  36. -------
  37. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  38. | :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayer2D_method_get_playback_position>` **(** **)** |
  39. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  40. | :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` | :ref:`get_stream_playback<class_AudioStreamPlayer2D_method_get_stream_playback>` **(** **)** |
  41. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`play<class_AudioStreamPlayer2D_method_play>` **(** :ref:`float<class_float>` from_position=0.0 **)** |
  43. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`seek<class_AudioStreamPlayer2D_method_seek>` **(** :ref:`float<class_float>` to_position **)** |
  45. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`stop<class_AudioStreamPlayer2D_method_stop>` **(** **)** |
  47. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  48. Signals
  49. -------
  50. .. _class_AudioStreamPlayer2D_signal_finished:
  51. - **finished** **(** **)**
  52. Emitted when the audio stops playing.
  53. Description
  54. -----------
  55. Plays audio that dampens with distance from screen center.
  56. Tutorials
  57. ---------
  58. - :doc:`../tutorials/audio/audio_streams`
  59. Property Descriptions
  60. ---------------------
  61. .. _class_AudioStreamPlayer2D_property_area_mask:
  62. - :ref:`int<class_int>` **area_mask**
  63. +----------+----------------------+
  64. | *Setter* | set_area_mask(value) |
  65. +----------+----------------------+
  66. | *Getter* | get_area_mask() |
  67. +----------+----------------------+
  68. Areas in which this sound plays.
  69. .. _class_AudioStreamPlayer2D_property_attenuation:
  70. - :ref:`float<class_float>` **attenuation**
  71. +----------+------------------------+
  72. | *Setter* | set_attenuation(value) |
  73. +----------+------------------------+
  74. | *Getter* | get_attenuation() |
  75. +----------+------------------------+
  76. Dampens audio over distance with this as an exponent.
  77. .. _class_AudioStreamPlayer2D_property_autoplay:
  78. - :ref:`bool<class_bool>` **autoplay**
  79. +----------+-----------------------+
  80. | *Setter* | set_autoplay(value) |
  81. +----------+-----------------------+
  82. | *Getter* | is_autoplay_enabled() |
  83. +----------+-----------------------+
  84. If ``true``, audio plays when added to scene tree. Default value: ``false``.
  85. .. _class_AudioStreamPlayer2D_property_bus:
  86. - :ref:`String<class_String>` **bus**
  87. +----------+----------------+
  88. | *Setter* | set_bus(value) |
  89. +----------+----------------+
  90. | *Getter* | get_bus() |
  91. +----------+----------------+
  92. Bus on which this audio is playing.
  93. .. _class_AudioStreamPlayer2D_property_max_distance:
  94. - :ref:`float<class_float>` **max_distance**
  95. +----------+-------------------------+
  96. | *Setter* | set_max_distance(value) |
  97. +----------+-------------------------+
  98. | *Getter* | get_max_distance() |
  99. +----------+-------------------------+
  100. Maximum distance from which audio is still hearable.
  101. .. _class_AudioStreamPlayer2D_property_pitch_scale:
  102. - :ref:`float<class_float>` **pitch_scale**
  103. +----------+------------------------+
  104. | *Setter* | set_pitch_scale(value) |
  105. +----------+------------------------+
  106. | *Getter* | get_pitch_scale() |
  107. +----------+------------------------+
  108. Changes the pitch and the tempo of the audio.
  109. .. _class_AudioStreamPlayer2D_property_playing:
  110. - :ref:`bool<class_bool>` **playing**
  111. +----------+--------------+
  112. | *Getter* | is_playing() |
  113. +----------+--------------+
  114. If ``true``, audio is playing.
  115. .. _class_AudioStreamPlayer2D_property_stream:
  116. - :ref:`AudioStream<class_AudioStream>` **stream**
  117. +----------+-------------------+
  118. | *Setter* | set_stream(value) |
  119. +----------+-------------------+
  120. | *Getter* | get_stream() |
  121. +----------+-------------------+
  122. The :ref:`AudioStream<class_AudioStream>` object to be played.
  123. .. _class_AudioStreamPlayer2D_property_stream_paused:
  124. - :ref:`bool<class_bool>` **stream_paused**
  125. +----------+--------------------------+
  126. | *Setter* | set_stream_paused(value) |
  127. +----------+--------------------------+
  128. | *Getter* | get_stream_paused() |
  129. +----------+--------------------------+
  130. .. _class_AudioStreamPlayer2D_property_volume_db:
  131. - :ref:`float<class_float>` **volume_db**
  132. +----------+----------------------+
  133. | *Setter* | set_volume_db(value) |
  134. +----------+----------------------+
  135. | *Getter* | get_volume_db() |
  136. +----------+----------------------+
  137. Base volume without dampening.
  138. Method Descriptions
  139. -------------------
  140. .. _class_AudioStreamPlayer2D_method_get_playback_position:
  141. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  142. Returns the position in the :ref:`AudioStream<class_AudioStream>`.
  143. .. _class_AudioStreamPlayer2D_method_get_stream_playback:
  144. - :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback** **(** **)**
  145. .. _class_AudioStreamPlayer2D_method_play:
  146. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  147. Plays the audio from the given position ``from_position``, in seconds.
  148. .. _class_AudioStreamPlayer2D_method_seek:
  149. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  150. Sets the position from which audio will be played, in seconds.
  151. .. _class_AudioStreamPlayer2D_method_stop:
  152. - void **stop** **(** **)**
  153. Stops the audio.