class_audiostreamplayer3d.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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>` | 1 |
  17. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  18. | :ref:`float<class_float>` | :ref:`attenuation_filter_cutoff_hz<class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz>` | 5000.0 |
  19. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  20. | :ref:`float<class_float>` | :ref:`attenuation_filter_db<class_AudioStreamPlayer3D_property_attenuation_filter_db>` | -24.0 |
  21. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  22. | :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` | :ref:`attenuation_model<class_AudioStreamPlayer3D_property_attenuation_model>` | 0 |
  23. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  24. | :ref:`bool<class_bool>` | :ref:`autoplay<class_AudioStreamPlayer3D_property_autoplay>` | false |
  25. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  26. | :ref:`String<class_String>` | :ref:`bus<class_AudioStreamPlayer3D_property_bus>` | "Master" |
  27. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  28. | :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` | :ref:`doppler_tracking<class_AudioStreamPlayer3D_property_doppler_tracking>` | 0 |
  29. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  30. | :ref:`float<class_float>` | :ref:`emission_angle_degrees<class_AudioStreamPlayer3D_property_emission_angle_degrees>` | 45.0 |
  31. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  32. | :ref:`bool<class_bool>` | :ref:`emission_angle_enabled<class_AudioStreamPlayer3D_property_emission_angle_enabled>` | false |
  33. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  34. | :ref:`float<class_float>` | :ref:`emission_angle_filter_attenuation_db<class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db>` | -12.0 |
  35. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  36. | :ref:`float<class_float>` | :ref:`max_db<class_AudioStreamPlayer3D_property_max_db>` | 3.0 |
  37. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  38. | :ref:`float<class_float>` | :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` | 0.0 |
  39. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  40. | :ref:`OutOfRangeMode<enum_AudioStreamPlayer3D_OutOfRangeMode>` | :ref:`out_of_range_mode<class_AudioStreamPlayer3D_property_out_of_range_mode>` | 0 |
  41. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  42. | :ref:`float<class_float>` | :ref:`pitch_scale<class_AudioStreamPlayer3D_property_pitch_scale>` | 1.0 |
  43. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  44. | :ref:`bool<class_bool>` | :ref:`playing<class_AudioStreamPlayer3D_property_playing>` | false |
  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>` | false |
  49. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  50. | :ref:`float<class_float>` | :ref:`unit_db<class_AudioStreamPlayer3D_property_unit_db>` | 0.0 |
  51. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+----------+
  52. | :ref:`float<class_float>` | :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>` | 1.0 |
  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. Emitted 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. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_DISABLED:
  79. enum **AttenuationModel**:
  80. - **ATTENUATION_INVERSE_DISTANCE** = **0** --- Linear dampening of loudness according to distance.
  81. - **ATTENUATION_INVERSE_SQUARE_DISTANCE** = **1** --- Squared dampening of loudness according to distance.
  82. - **ATTENUATION_LOGARITHMIC** = **2** --- Logarithmic dampening of loudness according to distance.
  83. - **ATTENUATION_DISABLED** = **3** --- No dampening of loudness according to distance.
  84. .. _enum_AudioStreamPlayer3D_OutOfRangeMode:
  85. .. _class_AudioStreamPlayer3D_constant_OUT_OF_RANGE_MIX:
  86. .. _class_AudioStreamPlayer3D_constant_OUT_OF_RANGE_PAUSE:
  87. enum **OutOfRangeMode**:
  88. - **OUT_OF_RANGE_MIX** = **0** --- Mix this audio in, even when it's out of range.
  89. - **OUT_OF_RANGE_PAUSE** = **1** --- Pause this audio when it gets out of range.
  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. | *Default* | 1 |
  110. +-----------+----------------------+
  111. | *Setter* | set_area_mask(value) |
  112. +-----------+----------------------+
  113. | *Getter* | get_area_mask() |
  114. +-----------+----------------------+
  115. Areas in which this sound plays.
  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. .. _class_AudioStreamPlayer3D_property_attenuation_filter_db:
  127. - :ref:`float<class_float>` **attenuation_filter_db**
  128. +-----------+----------------------------------+
  129. | *Default* | -24.0 |
  130. +-----------+----------------------------------+
  131. | *Setter* | set_attenuation_filter_db(value) |
  132. +-----------+----------------------------------+
  133. | *Getter* | get_attenuation_filter_db() |
  134. +-----------+----------------------------------+
  135. Amount how much the filter affects the loudness, in dB.
  136. .. _class_AudioStreamPlayer3D_property_attenuation_model:
  137. - :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **attenuation_model**
  138. +-----------+------------------------------+
  139. | *Default* | 0 |
  140. +-----------+------------------------------+
  141. | *Setter* | set_attenuation_model(value) |
  142. +-----------+------------------------------+
  143. | *Getter* | get_attenuation_model() |
  144. +-----------+------------------------------+
  145. Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or not be affected by distance, effectively disabling attenuation.
  146. .. _class_AudioStreamPlayer3D_property_autoplay:
  147. - :ref:`bool<class_bool>` **autoplay**
  148. +-----------+-----------------------+
  149. | *Default* | false |
  150. +-----------+-----------------------+
  151. | *Setter* | set_autoplay(value) |
  152. +-----------+-----------------------+
  153. | *Getter* | is_autoplay_enabled() |
  154. +-----------+-----------------------+
  155. If ``true``, audio plays when added to scene tree.
  156. .. _class_AudioStreamPlayer3D_property_bus:
  157. - :ref:`String<class_String>` **bus**
  158. +-----------+----------------+
  159. | *Default* | "Master" |
  160. +-----------+----------------+
  161. | *Setter* | set_bus(value) |
  162. +-----------+----------------+
  163. | *Getter* | get_bus() |
  164. +-----------+----------------+
  165. Bus on which this audio is playing.
  166. .. _class_AudioStreamPlayer3D_property_doppler_tracking:
  167. - :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **doppler_tracking**
  168. +-----------+-----------------------------+
  169. | *Default* | 0 |
  170. +-----------+-----------------------------+
  171. | *Setter* | set_doppler_tracking(value) |
  172. +-----------+-----------------------------+
  173. | *Getter* | get_doppler_tracking() |
  174. +-----------+-----------------------------+
  175. Decides in which step the Doppler effect should be calculated.
  176. .. _class_AudioStreamPlayer3D_property_emission_angle_degrees:
  177. - :ref:`float<class_float>` **emission_angle_degrees**
  178. +-----------+---------------------------+
  179. | *Default* | 45.0 |
  180. +-----------+---------------------------+
  181. | *Setter* | set_emission_angle(value) |
  182. +-----------+---------------------------+
  183. | *Getter* | get_emission_angle() |
  184. +-----------+---------------------------+
  185. The angle in which the audio reaches cameras undampened.
  186. .. _class_AudioStreamPlayer3D_property_emission_angle_enabled:
  187. - :ref:`bool<class_bool>` **emission_angle_enabled**
  188. +-----------+-----------------------------------+
  189. | *Default* | false |
  190. +-----------+-----------------------------------+
  191. | *Setter* | set_emission_angle_enabled(value) |
  192. +-----------+-----------------------------------+
  193. | *Getter* | is_emission_angle_enabled() |
  194. +-----------+-----------------------------------+
  195. If ``true``, the audio should be dampened according to the direction of the sound.
  196. .. _class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db:
  197. - :ref:`float<class_float>` **emission_angle_filter_attenuation_db**
  198. +-----------+-------------------------------------------------+
  199. | *Default* | -12.0 |
  200. +-----------+-------------------------------------------------+
  201. | *Setter* | set_emission_angle_filter_attenuation_db(value) |
  202. +-----------+-------------------------------------------------+
  203. | *Getter* | get_emission_angle_filter_attenuation_db() |
  204. +-----------+-------------------------------------------------+
  205. 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.
  206. .. _class_AudioStreamPlayer3D_property_max_db:
  207. - :ref:`float<class_float>` **max_db**
  208. +-----------+-------------------+
  209. | *Default* | 3.0 |
  210. +-----------+-------------------+
  211. | *Setter* | set_max_db(value) |
  212. +-----------+-------------------+
  213. | *Getter* | get_max_db() |
  214. +-----------+-------------------+
  215. Sets the absolute maximum of the soundlevel, in dB.
  216. .. _class_AudioStreamPlayer3D_property_max_distance:
  217. - :ref:`float<class_float>` **max_distance**
  218. +-----------+-------------------------+
  219. | *Default* | 0.0 |
  220. +-----------+-------------------------+
  221. | *Setter* | set_max_distance(value) |
  222. +-----------+-------------------------+
  223. | *Getter* | get_max_distance() |
  224. +-----------+-------------------------+
  225. 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.
  226. .. _class_AudioStreamPlayer3D_property_out_of_range_mode:
  227. - :ref:`OutOfRangeMode<enum_AudioStreamPlayer3D_OutOfRangeMode>` **out_of_range_mode**
  228. +-----------+------------------------------+
  229. | *Default* | 0 |
  230. +-----------+------------------------------+
  231. | *Setter* | set_out_of_range_mode(value) |
  232. +-----------+------------------------------+
  233. | *Getter* | get_out_of_range_mode() |
  234. +-----------+------------------------------+
  235. Decides if audio should pause when source is outside of :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` range.
  236. .. _class_AudioStreamPlayer3D_property_pitch_scale:
  237. - :ref:`float<class_float>` **pitch_scale**
  238. +-----------+------------------------+
  239. | *Default* | 1.0 |
  240. +-----------+------------------------+
  241. | *Setter* | set_pitch_scale(value) |
  242. +-----------+------------------------+
  243. | *Getter* | get_pitch_scale() |
  244. +-----------+------------------------+
  245. Changes the pitch and the tempo of the audio.
  246. .. _class_AudioStreamPlayer3D_property_playing:
  247. - :ref:`bool<class_bool>` **playing**
  248. +-----------+--------------+
  249. | *Default* | false |
  250. +-----------+--------------+
  251. | *Getter* | is_playing() |
  252. +-----------+--------------+
  253. If ``true``, audio is playing.
  254. .. _class_AudioStreamPlayer3D_property_stream:
  255. - :ref:`AudioStream<class_AudioStream>` **stream**
  256. +----------+-------------------+
  257. | *Setter* | set_stream(value) |
  258. +----------+-------------------+
  259. | *Getter* | get_stream() |
  260. +----------+-------------------+
  261. The :ref:`AudioStream<class_AudioStream>` object to be played.
  262. .. _class_AudioStreamPlayer3D_property_stream_paused:
  263. - :ref:`bool<class_bool>` **stream_paused**
  264. +-----------+--------------------------+
  265. | *Default* | false |
  266. +-----------+--------------------------+
  267. | *Setter* | set_stream_paused(value) |
  268. +-----------+--------------------------+
  269. | *Getter* | get_stream_paused() |
  270. +-----------+--------------------------+
  271. .. _class_AudioStreamPlayer3D_property_unit_db:
  272. - :ref:`float<class_float>` **unit_db**
  273. +-----------+--------------------+
  274. | *Default* | 0.0 |
  275. +-----------+--------------------+
  276. | *Setter* | set_unit_db(value) |
  277. +-----------+--------------------+
  278. | *Getter* | get_unit_db() |
  279. +-----------+--------------------+
  280. Base sound level unaffected by dampening, in dB.
  281. .. _class_AudioStreamPlayer3D_property_unit_size:
  282. - :ref:`float<class_float>` **unit_size**
  283. +-----------+----------------------+
  284. | *Default* | 1.0 |
  285. +-----------+----------------------+
  286. | *Setter* | set_unit_size(value) |
  287. +-----------+----------------------+
  288. | *Getter* | get_unit_size() |
  289. +-----------+----------------------+
  290. Factor for the attenuation effect.
  291. Method Descriptions
  292. -------------------
  293. .. _class_AudioStreamPlayer3D_method_get_playback_position:
  294. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  295. Returns the position in the :ref:`AudioStream<class_AudioStream>`.
  296. .. _class_AudioStreamPlayer3D_method_get_stream_playback:
  297. - :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback** **(** **)**
  298. .. _class_AudioStreamPlayer3D_method_play:
  299. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  300. Plays the audio from the given position ``from_position``, in seconds.
  301. .. _class_AudioStreamPlayer3D_method_seek:
  302. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  303. Sets the position from which audio will be played, in seconds.
  304. .. _class_AudioStreamPlayer3D_method_stop:
  305. - void **stop** **(** **)**
  306. Stops the audio.