class_audiostreamplayer3d.rst 22 KB

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