class_audiostreamplayer3d.rst 22 KB

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