class_audiostreamplayer3d.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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 AudioStreamPlayer3D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AudioStreamPlayer3D:
  6. AudioStreamPlayer3D
  7. ===================
  8. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Plays 3D sound in 3D space.
  13. Properties
  14. ----------
  15. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`area_mask<class_AudioStreamPlayer3D_property_area_mask>` |
  17. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`float<class_float>` | :ref:`attenuation_filter_cutoff_hz<class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz>` |
  19. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`attenuation_filter_db<class_AudioStreamPlayer3D_property_attenuation_filter_db>` |
  21. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` | :ref:`attenuation_model<class_AudioStreamPlayer3D_property_attenuation_model>` |
  23. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`autoplay<class_AudioStreamPlayer3D_property_autoplay>` |
  25. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`bus<class_AudioStreamPlayer3D_property_bus>` |
  27. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` | :ref:`doppler_tracking<class_AudioStreamPlayer3D_property_doppler_tracking>` |
  29. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`float<class_float>` | :ref:`emission_angle_degrees<class_AudioStreamPlayer3D_property_emission_angle_degrees>` |
  31. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`emission_angle_enabled<class_AudioStreamPlayer3D_property_emission_angle_enabled>` |
  33. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`float<class_float>` | :ref:`emission_angle_filter_attenuation_db<class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db>` |
  35. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`float<class_float>` | :ref:`max_db<class_AudioStreamPlayer3D_property_max_db>` |
  37. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`float<class_float>` | :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` |
  39. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`OutOfRangeMode<enum_AudioStreamPlayer3D_OutOfRangeMode>` | :ref:`out_of_range_mode<class_AudioStreamPlayer3D_property_out_of_range_mode>` |
  41. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`float<class_float>` | :ref:`pitch_scale<class_AudioStreamPlayer3D_property_pitch_scale>` |
  43. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`bool<class_bool>` | :ref:`playing<class_AudioStreamPlayer3D_property_playing>` |
  45. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`AudioStream<class_AudioStream>` | :ref:`stream<class_AudioStreamPlayer3D_property_stream>` |
  47. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`bool<class_bool>` | :ref:`stream_paused<class_AudioStreamPlayer3D_property_stream_paused>` |
  49. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`float<class_float>` | :ref:`unit_db<class_AudioStreamPlayer3D_property_unit_db>` |
  51. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`float<class_float>` | :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>` |
  53. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+
  54. Methods
  55. -------
  56. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  57. | :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayer3D_method_get_playback_position>` **(** **)** |
  58. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  59. | :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` | :ref:`get_stream_playback<class_AudioStreamPlayer3D_method_get_stream_playback>` **(** **)** |
  60. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`play<class_AudioStreamPlayer3D_method_play>` **(** :ref:`float<class_float>` from_position=0.0 **)** |
  62. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`seek<class_AudioStreamPlayer3D_method_seek>` **(** :ref:`float<class_float>` to_position **)** |
  64. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`stop<class_AudioStreamPlayer3D_method_stop>` **(** **)** |
  66. +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+
  67. Signals
  68. -------
  69. .. _class_AudioStreamPlayer3D_signal_finished:
  70. - **finished** **(** **)**
  71. Fires when the audio stops playing.
  72. Enumerations
  73. ------------
  74. .. _enum_AudioStreamPlayer3D_AttenuationModel:
  75. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_INVERSE_DISTANCE:
  76. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_INVERSE_SQUARE_DISTANCE:
  77. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_LOGARITHMIC:
  78. enum **AttenuationModel**:
  79. - **ATTENUATION_INVERSE_DISTANCE** = **0** --- Linear dampening of loudness according to distance.
  80. - **ATTENUATION_INVERSE_SQUARE_DISTANCE** = **1** --- Squared dampening of loudness according to distance.
  81. - **ATTENUATION_LOGARITHMIC** = **2** --- Logarithmic dampening of loudness according to distance.
  82. .. _enum_AudioStreamPlayer3D_OutOfRangeMode:
  83. .. _class_AudioStreamPlayer3D_constant_OUT_OF_RANGE_MIX:
  84. .. _class_AudioStreamPlayer3D_constant_OUT_OF_RANGE_PAUSE:
  85. enum **OutOfRangeMode**:
  86. - **OUT_OF_RANGE_MIX** = **0** --- Mix this audio in, even when it's out of range.
  87. - **OUT_OF_RANGE_PAUSE** = **1** --- Pause this audio when it gets out of range.
  88. .. _enum_AudioStreamPlayer3D_DopplerTracking:
  89. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_DISABLED:
  90. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_IDLE_STEP:
  91. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_PHYSICS_STEP:
  92. enum **DopplerTracking**:
  93. - **DOPPLER_TRACKING_DISABLED** = **0** --- Disables doppler tracking.
  94. - **DOPPLER_TRACKING_IDLE_STEP** = **1** --- Executes doppler tracking in idle step.
  95. - **DOPPLER_TRACKING_PHYSICS_STEP** = **2** --- Executes doppler tracking in physics step.
  96. Description
  97. -----------
  98. Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space.
  99. Tutorials
  100. ---------
  101. - :doc:`../tutorials/audio/audio_streams`
  102. Property Descriptions
  103. ---------------------
  104. .. _class_AudioStreamPlayer3D_property_area_mask:
  105. - :ref:`int<class_int>` **area_mask**
  106. +----------+----------------------+
  107. | *Setter* | set_area_mask(value) |
  108. +----------+----------------------+
  109. | *Getter* | get_area_mask() |
  110. +----------+----------------------+
  111. Areas in which this sound plays.
  112. .. _class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz:
  113. - :ref:`float<class_float>` **attenuation_filter_cutoff_hz**
  114. +----------+-----------------------------------------+
  115. | *Setter* | set_attenuation_filter_cutoff_hz(value) |
  116. +----------+-----------------------------------------+
  117. | *Getter* | get_attenuation_filter_cutoff_hz() |
  118. +----------+-----------------------------------------+
  119. Dampens audio above this frequency, in Hz.
  120. .. _class_AudioStreamPlayer3D_property_attenuation_filter_db:
  121. - :ref:`float<class_float>` **attenuation_filter_db**
  122. +----------+----------------------------------+
  123. | *Setter* | set_attenuation_filter_db(value) |
  124. +----------+----------------------------------+
  125. | *Getter* | get_attenuation_filter_db() |
  126. +----------+----------------------------------+
  127. Amount how much the filter affects the loudness, in dB.
  128. .. _class_AudioStreamPlayer3D_property_attenuation_model:
  129. - :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **attenuation_model**
  130. +----------+------------------------------+
  131. | *Setter* | set_attenuation_model(value) |
  132. +----------+------------------------------+
  133. | *Getter* | get_attenuation_model() |
  134. +----------+------------------------------+
  135. Decides if audio should get quieter with distance linearly, quadratically or logarithmically.
  136. .. _class_AudioStreamPlayer3D_property_autoplay:
  137. - :ref:`bool<class_bool>` **autoplay**
  138. +----------+-----------------------+
  139. | *Setter* | set_autoplay(value) |
  140. +----------+-----------------------+
  141. | *Getter* | is_autoplay_enabled() |
  142. +----------+-----------------------+
  143. If ``true``, audio plays when added to scene tree. Default value: ``false``.
  144. .. _class_AudioStreamPlayer3D_property_bus:
  145. - :ref:`String<class_String>` **bus**
  146. +----------+----------------+
  147. | *Setter* | set_bus(value) |
  148. +----------+----------------+
  149. | *Getter* | get_bus() |
  150. +----------+----------------+
  151. Bus on which this audio is playing.
  152. .. _class_AudioStreamPlayer3D_property_doppler_tracking:
  153. - :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **doppler_tracking**
  154. +----------+-----------------------------+
  155. | *Setter* | set_doppler_tracking(value) |
  156. +----------+-----------------------------+
  157. | *Getter* | get_doppler_tracking() |
  158. +----------+-----------------------------+
  159. Decides in which step the Doppler effect should be calculated.
  160. .. _class_AudioStreamPlayer3D_property_emission_angle_degrees:
  161. - :ref:`float<class_float>` **emission_angle_degrees**
  162. +----------+---------------------------+
  163. | *Setter* | set_emission_angle(value) |
  164. +----------+---------------------------+
  165. | *Getter* | get_emission_angle() |
  166. +----------+---------------------------+
  167. The angle in which the audio reaches cameras undampened.
  168. .. _class_AudioStreamPlayer3D_property_emission_angle_enabled:
  169. - :ref:`bool<class_bool>` **emission_angle_enabled**
  170. +----------+-----------------------------------+
  171. | *Setter* | set_emission_angle_enabled(value) |
  172. +----------+-----------------------------------+
  173. | *Getter* | is_emission_angle_enabled() |
  174. +----------+-----------------------------------+
  175. If ``true``, the audio should be dampened according to the direction of the sound.
  176. .. _class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db:
  177. - :ref:`float<class_float>` **emission_angle_filter_attenuation_db**
  178. +----------+-------------------------------------------------+
  179. | *Setter* | set_emission_angle_filter_attenuation_db(value) |
  180. +----------+-------------------------------------------------+
  181. | *Getter* | get_emission_angle_filter_attenuation_db() |
  182. +----------+-------------------------------------------------+
  183. dampens audio if camera is outside of 'emission_angle_degrees' and 'emission_angle_enabled' is set by this factor, in dB.
  184. .. _class_AudioStreamPlayer3D_property_max_db:
  185. - :ref:`float<class_float>` **max_db**
  186. +----------+-------------------+
  187. | *Setter* | set_max_db(value) |
  188. +----------+-------------------+
  189. | *Getter* | get_max_db() |
  190. +----------+-------------------+
  191. Sets the absolute maximum of the soundlevel, in dB.
  192. .. _class_AudioStreamPlayer3D_property_max_distance:
  193. - :ref:`float<class_float>` **max_distance**
  194. +----------+-------------------------+
  195. | *Setter* | set_max_distance(value) |
  196. +----------+-------------------------+
  197. | *Getter* | get_max_distance() |
  198. +----------+-------------------------+
  199. Sets the distance from which the 'out_of_range_mode' takes effect. Has no effect if set to 0.
  200. .. _class_AudioStreamPlayer3D_property_out_of_range_mode:
  201. - :ref:`OutOfRangeMode<enum_AudioStreamPlayer3D_OutOfRangeMode>` **out_of_range_mode**
  202. +----------+------------------------------+
  203. | *Setter* | set_out_of_range_mode(value) |
  204. +----------+------------------------------+
  205. | *Getter* | get_out_of_range_mode() |
  206. +----------+------------------------------+
  207. Decides if audio should pause when source is outside of 'max_distance' range.
  208. .. _class_AudioStreamPlayer3D_property_pitch_scale:
  209. - :ref:`float<class_float>` **pitch_scale**
  210. +----------+------------------------+
  211. | *Setter* | set_pitch_scale(value) |
  212. +----------+------------------------+
  213. | *Getter* | get_pitch_scale() |
  214. +----------+------------------------+
  215. Changes the pitch and the tempo of the audio.
  216. .. _class_AudioStreamPlayer3D_property_playing:
  217. - :ref:`bool<class_bool>` **playing**
  218. +----------+--------------+
  219. | *Getter* | is_playing() |
  220. +----------+--------------+
  221. If ``true``, audio is playing.
  222. .. _class_AudioStreamPlayer3D_property_stream:
  223. - :ref:`AudioStream<class_AudioStream>` **stream**
  224. +----------+-------------------+
  225. | *Setter* | set_stream(value) |
  226. +----------+-------------------+
  227. | *Getter* | get_stream() |
  228. +----------+-------------------+
  229. The :ref:`AudioStream<class_AudioStream>` object to be played.
  230. .. _class_AudioStreamPlayer3D_property_stream_paused:
  231. - :ref:`bool<class_bool>` **stream_paused**
  232. +----------+--------------------------+
  233. | *Setter* | set_stream_paused(value) |
  234. +----------+--------------------------+
  235. | *Getter* | get_stream_paused() |
  236. +----------+--------------------------+
  237. .. _class_AudioStreamPlayer3D_property_unit_db:
  238. - :ref:`float<class_float>` **unit_db**
  239. +----------+--------------------+
  240. | *Setter* | set_unit_db(value) |
  241. +----------+--------------------+
  242. | *Getter* | get_unit_db() |
  243. +----------+--------------------+
  244. Base sound level unaffected by dampening, in dB.
  245. .. _class_AudioStreamPlayer3D_property_unit_size:
  246. - :ref:`float<class_float>` **unit_size**
  247. +----------+----------------------+
  248. | *Setter* | set_unit_size(value) |
  249. +----------+----------------------+
  250. | *Getter* | get_unit_size() |
  251. +----------+----------------------+
  252. Factor for the attenuation effect.
  253. Method Descriptions
  254. -------------------
  255. .. _class_AudioStreamPlayer3D_method_get_playback_position:
  256. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  257. Returns the position in the :ref:`AudioStream<class_AudioStream>`.
  258. .. _class_AudioStreamPlayer3D_method_get_stream_playback:
  259. - :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback** **(** **)**
  260. .. _class_AudioStreamPlayer3D_method_play:
  261. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  262. Plays the audio from the given position 'from_position', in seconds.
  263. .. _class_AudioStreamPlayer3D_method_seek:
  264. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  265. Sets the position from which audio will be played, in seconds.
  266. .. _class_AudioStreamPlayer3D_method_stop:
  267. - void **stop** **(** **)**
  268. Stops the audio.