class_audiostreamplayer3d.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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. ----
  83. .. _enum_AudioStreamPlayer3D_OutOfRangeMode:
  84. .. _class_AudioStreamPlayer3D_constant_OUT_OF_RANGE_MIX:
  85. .. _class_AudioStreamPlayer3D_constant_OUT_OF_RANGE_PAUSE:
  86. enum **OutOfRangeMode**:
  87. - **OUT_OF_RANGE_MIX** = **0** --- Mix this audio in, even when it's out of range.
  88. - **OUT_OF_RANGE_PAUSE** = **1** --- Pause this audio when it gets out of range.
  89. ----
  90. .. _enum_AudioStreamPlayer3D_DopplerTracking:
  91. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_DISABLED:
  92. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_IDLE_STEP:
  93. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_PHYSICS_STEP:
  94. enum **DopplerTracking**:
  95. - **DOPPLER_TRACKING_DISABLED** = **0** --- Disables doppler tracking.
  96. - **DOPPLER_TRACKING_IDLE_STEP** = **1** --- Executes doppler tracking in idle step.
  97. - **DOPPLER_TRACKING_PHYSICS_STEP** = **2** --- Executes doppler tracking in physics step.
  98. Description
  99. -----------
  100. Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space.
  101. Tutorials
  102. ---------
  103. - :doc:`../tutorials/audio/audio_streams`
  104. Property Descriptions
  105. ---------------------
  106. .. _class_AudioStreamPlayer3D_property_area_mask:
  107. - :ref:`int<class_int>` **area_mask**
  108. +----------+----------------------+
  109. | *Setter* | set_area_mask(value) |
  110. +----------+----------------------+
  111. | *Getter* | get_area_mask() |
  112. +----------+----------------------+
  113. Areas in which this sound plays.
  114. ----
  115. .. _class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz:
  116. - :ref:`float<class_float>` **attenuation_filter_cutoff_hz**
  117. +----------+-----------------------------------------+
  118. | *Setter* | set_attenuation_filter_cutoff_hz(value) |
  119. +----------+-----------------------------------------+
  120. | *Getter* | get_attenuation_filter_cutoff_hz() |
  121. +----------+-----------------------------------------+
  122. Dampens audio above this frequency, in Hz.
  123. ----
  124. .. _class_AudioStreamPlayer3D_property_attenuation_filter_db:
  125. - :ref:`float<class_float>` **attenuation_filter_db**
  126. +----------+----------------------------------+
  127. | *Setter* | set_attenuation_filter_db(value) |
  128. +----------+----------------------------------+
  129. | *Getter* | get_attenuation_filter_db() |
  130. +----------+----------------------------------+
  131. Amount how much the filter affects the loudness, in dB.
  132. ----
  133. .. _class_AudioStreamPlayer3D_property_attenuation_model:
  134. - :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **attenuation_model**
  135. +----------+------------------------------+
  136. | *Setter* | set_attenuation_model(value) |
  137. +----------+------------------------------+
  138. | *Getter* | get_attenuation_model() |
  139. +----------+------------------------------+
  140. Decides if audio should get quieter with distance linearly, quadratically or logarithmically.
  141. ----
  142. .. _class_AudioStreamPlayer3D_property_autoplay:
  143. - :ref:`bool<class_bool>` **autoplay**
  144. +----------+-----------------------+
  145. | *Setter* | set_autoplay(value) |
  146. +----------+-----------------------+
  147. | *Getter* | is_autoplay_enabled() |
  148. +----------+-----------------------+
  149. If ``true``, audio plays when added to scene tree. Default value: ``false``.
  150. ----
  151. .. _class_AudioStreamPlayer3D_property_bus:
  152. - :ref:`String<class_String>` **bus**
  153. +----------+----------------+
  154. | *Setter* | set_bus(value) |
  155. +----------+----------------+
  156. | *Getter* | get_bus() |
  157. +----------+----------------+
  158. Bus on which this audio is playing.
  159. ----
  160. .. _class_AudioStreamPlayer3D_property_doppler_tracking:
  161. - :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **doppler_tracking**
  162. +----------+-----------------------------+
  163. | *Setter* | set_doppler_tracking(value) |
  164. +----------+-----------------------------+
  165. | *Getter* | get_doppler_tracking() |
  166. +----------+-----------------------------+
  167. Decides in which step the Doppler effect should be calculated.
  168. ----
  169. .. _class_AudioStreamPlayer3D_property_emission_angle_degrees:
  170. - :ref:`float<class_float>` **emission_angle_degrees**
  171. +----------+---------------------------+
  172. | *Setter* | set_emission_angle(value) |
  173. +----------+---------------------------+
  174. | *Getter* | get_emission_angle() |
  175. +----------+---------------------------+
  176. The angle in which the audio reaches cameras undampened.
  177. ----
  178. .. _class_AudioStreamPlayer3D_property_emission_angle_enabled:
  179. - :ref:`bool<class_bool>` **emission_angle_enabled**
  180. +----------+-----------------------------------+
  181. | *Setter* | set_emission_angle_enabled(value) |
  182. +----------+-----------------------------------+
  183. | *Getter* | is_emission_angle_enabled() |
  184. +----------+-----------------------------------+
  185. If ``true``, the audio should be dampened according to the direction of the sound.
  186. ----
  187. .. _class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db:
  188. - :ref:`float<class_float>` **emission_angle_filter_attenuation_db**
  189. +----------+-------------------------------------------------+
  190. | *Setter* | set_emission_angle_filter_attenuation_db(value) |
  191. +----------+-------------------------------------------------+
  192. | *Getter* | get_emission_angle_filter_attenuation_db() |
  193. +----------+-------------------------------------------------+
  194. dampens audio if camera is outside of 'emission_angle_degrees' and 'emission_angle_enabled' is set by this factor, in dB.
  195. ----
  196. .. _class_AudioStreamPlayer3D_property_max_db:
  197. - :ref:`float<class_float>` **max_db**
  198. +----------+-------------------+
  199. | *Setter* | set_max_db(value) |
  200. +----------+-------------------+
  201. | *Getter* | get_max_db() |
  202. +----------+-------------------+
  203. Sets the absolute maximum of the soundlevel, in dB.
  204. ----
  205. .. _class_AudioStreamPlayer3D_property_max_distance:
  206. - :ref:`float<class_float>` **max_distance**
  207. +----------+-------------------------+
  208. | *Setter* | set_max_distance(value) |
  209. +----------+-------------------------+
  210. | *Getter* | get_max_distance() |
  211. +----------+-------------------------+
  212. Sets the distance from which the 'out_of_range_mode' takes effect. Has no effect if set to 0.
  213. ----
  214. .. _class_AudioStreamPlayer3D_property_out_of_range_mode:
  215. - :ref:`OutOfRangeMode<enum_AudioStreamPlayer3D_OutOfRangeMode>` **out_of_range_mode**
  216. +----------+------------------------------+
  217. | *Setter* | set_out_of_range_mode(value) |
  218. +----------+------------------------------+
  219. | *Getter* | get_out_of_range_mode() |
  220. +----------+------------------------------+
  221. Decides if audio should pause when source is outside of 'max_distance' range.
  222. ----
  223. .. _class_AudioStreamPlayer3D_property_pitch_scale:
  224. - :ref:`float<class_float>` **pitch_scale**
  225. +----------+------------------------+
  226. | *Setter* | set_pitch_scale(value) |
  227. +----------+------------------------+
  228. | *Getter* | get_pitch_scale() |
  229. +----------+------------------------+
  230. Changes the pitch and the tempo of the audio.
  231. ----
  232. .. _class_AudioStreamPlayer3D_property_playing:
  233. - :ref:`bool<class_bool>` **playing**
  234. +----------+--------------+
  235. | *Getter* | is_playing() |
  236. +----------+--------------+
  237. If ``true``, audio is playing.
  238. ----
  239. .. _class_AudioStreamPlayer3D_property_stream:
  240. - :ref:`AudioStream<class_AudioStream>` **stream**
  241. +----------+-------------------+
  242. | *Setter* | set_stream(value) |
  243. +----------+-------------------+
  244. | *Getter* | get_stream() |
  245. +----------+-------------------+
  246. The :ref:`AudioStream<class_AudioStream>` object to be played.
  247. ----
  248. .. _class_AudioStreamPlayer3D_property_stream_paused:
  249. - :ref:`bool<class_bool>` **stream_paused**
  250. +----------+--------------------------+
  251. | *Setter* | set_stream_paused(value) |
  252. +----------+--------------------------+
  253. | *Getter* | get_stream_paused() |
  254. +----------+--------------------------+
  255. ----
  256. .. _class_AudioStreamPlayer3D_property_unit_db:
  257. - :ref:`float<class_float>` **unit_db**
  258. +----------+--------------------+
  259. | *Setter* | set_unit_db(value) |
  260. +----------+--------------------+
  261. | *Getter* | get_unit_db() |
  262. +----------+--------------------+
  263. Base sound level unaffected by dampening, in dB.
  264. ----
  265. .. _class_AudioStreamPlayer3D_property_unit_size:
  266. - :ref:`float<class_float>` **unit_size**
  267. +----------+----------------------+
  268. | *Setter* | set_unit_size(value) |
  269. +----------+----------------------+
  270. | *Getter* | get_unit_size() |
  271. +----------+----------------------+
  272. Factor for the attenuation effect.
  273. Method Descriptions
  274. -------------------
  275. .. _class_AudioStreamPlayer3D_method_get_playback_position:
  276. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  277. Returns the position in the :ref:`AudioStream<class_AudioStream>`.
  278. ----
  279. .. _class_AudioStreamPlayer3D_method_get_stream_playback:
  280. - :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback** **(** **)**
  281. ----
  282. .. _class_AudioStreamPlayer3D_method_play:
  283. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  284. Plays the audio from the given position 'from_position', in seconds.
  285. ----
  286. .. _class_AudioStreamPlayer3D_method_seek:
  287. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  288. Sets the position from which audio will be played, in seconds.
  289. ----
  290. .. _class_AudioStreamPlayer3D_method_stop:
  291. - void **stop** **(** **)**
  292. Stops the audio.