class_audiostreamplayer2d.rst 8.9 KB

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