class_audiostreamplayer3d.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. :github_url: hide
  2. .. meta::
  3. :keywords: sound, sfx
  4. .. DO NOT EDIT THIS FILE!!!
  5. .. Generated automatically from Godot engine sources.
  6. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  7. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer3D.xml.
  8. .. _class_AudioStreamPlayer3D:
  9. AudioStreamPlayer3D
  10. ===================
  11. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  12. Plays positional sound in 3D space.
  13. .. rst-class:: classref-introduction-group
  14. Description
  15. -----------
  16. Plays audio with positional sound effects, based on the relative position of the audio listener. Positional effects include distance attenuation, directionality, and the Doppler effect. For greater realism, a low-pass filter is applied to distant sounds. This can be disabled by setting :ref:`attenuation_filter_cutoff_hz<class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz>` to ``20500``.
  17. By default, audio is heard from the camera position. This can be changed by adding an :ref:`AudioListener3D<class_AudioListener3D>` node to the scene and enabling it by calling :ref:`AudioListener3D.make_current()<class_AudioListener3D_method_make_current>` on it.
  18. See also :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` to play a sound non-positionally.
  19. \ **Note:** Hiding an **AudioStreamPlayer3D** node does not disable its audio output. To temporarily disable an **AudioStreamPlayer3D**'s audio output, set :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` to a very low value like ``-100`` (which isn't audible to human hearing).
  20. .. rst-class:: classref-introduction-group
  21. Tutorials
  22. ---------
  23. - :doc:`Audio streams <../tutorials/audio/audio_streams>`
  24. .. rst-class:: classref-reftable-group
  25. Properties
  26. ----------
  27. .. table::
  28. :widths: auto
  29. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  30. | :ref:`int<class_int>` | :ref:`area_mask<class_AudioStreamPlayer3D_property_area_mask>` | ``1`` |
  31. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  32. | :ref:`float<class_float>` | :ref:`attenuation_filter_cutoff_hz<class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz>` | ``5000.0`` |
  33. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  34. | :ref:`float<class_float>` | :ref:`attenuation_filter_db<class_AudioStreamPlayer3D_property_attenuation_filter_db>` | ``-24.0`` |
  35. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  36. | :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` | :ref:`attenuation_model<class_AudioStreamPlayer3D_property_attenuation_model>` | ``0`` |
  37. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  38. | :ref:`bool<class_bool>` | :ref:`autoplay<class_AudioStreamPlayer3D_property_autoplay>` | ``false`` |
  39. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  40. | :ref:`StringName<class_StringName>` | :ref:`bus<class_AudioStreamPlayer3D_property_bus>` | ``&"Master"`` |
  41. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  42. | :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` | :ref:`doppler_tracking<class_AudioStreamPlayer3D_property_doppler_tracking>` | ``0`` |
  43. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  44. | :ref:`float<class_float>` | :ref:`emission_angle_degrees<class_AudioStreamPlayer3D_property_emission_angle_degrees>` | ``45.0`` |
  45. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  46. | :ref:`bool<class_bool>` | :ref:`emission_angle_enabled<class_AudioStreamPlayer3D_property_emission_angle_enabled>` | ``false`` |
  47. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  48. | :ref:`float<class_float>` | :ref:`emission_angle_filter_attenuation_db<class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db>` | ``-12.0`` |
  49. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  50. | :ref:`float<class_float>` | :ref:`max_db<class_AudioStreamPlayer3D_property_max_db>` | ``3.0`` |
  51. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  52. | :ref:`float<class_float>` | :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` | ``0.0`` |
  53. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  54. | :ref:`int<class_int>` | :ref:`max_polyphony<class_AudioStreamPlayer3D_property_max_polyphony>` | ``1`` |
  55. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  56. | :ref:`float<class_float>` | :ref:`panning_strength<class_AudioStreamPlayer3D_property_panning_strength>` | ``1.0`` |
  57. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  58. | :ref:`float<class_float>` | :ref:`pitch_scale<class_AudioStreamPlayer3D_property_pitch_scale>` | ``1.0`` |
  59. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  60. | :ref:`PlaybackType<enum_AudioServer_PlaybackType>` | :ref:`playback_type<class_AudioStreamPlayer3D_property_playback_type>` | ``0`` |
  61. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  62. | :ref:`bool<class_bool>` | :ref:`playing<class_AudioStreamPlayer3D_property_playing>` | ``false`` |
  63. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  64. | :ref:`AudioStream<class_AudioStream>` | :ref:`stream<class_AudioStreamPlayer3D_property_stream>` | |
  65. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  66. | :ref:`bool<class_bool>` | :ref:`stream_paused<class_AudioStreamPlayer3D_property_stream_paused>` | ``false`` |
  67. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  68. | :ref:`float<class_float>` | :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>` | ``10.0`` |
  69. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  70. | :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` | ``0.0`` |
  71. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  72. | :ref:`float<class_float>` | :ref:`volume_linear<class_AudioStreamPlayer3D_property_volume_linear>` | |
  73. +--------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------+---------------+
  74. .. rst-class:: classref-reftable-group
  75. Methods
  76. -------
  77. .. table::
  78. :widths: auto
  79. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  80. | :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayer3D_method_get_playback_position>`\ (\ ) |
  81. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  82. | :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` | :ref:`get_stream_playback<class_AudioStreamPlayer3D_method_get_stream_playback>`\ (\ ) |
  83. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  84. | :ref:`bool<class_bool>` | :ref:`has_stream_playback<class_AudioStreamPlayer3D_method_has_stream_playback>`\ (\ ) |
  85. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  86. | |void| | :ref:`play<class_AudioStreamPlayer3D_method_play>`\ (\ from_position\: :ref:`float<class_float>` = 0.0\ ) |
  87. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  88. | |void| | :ref:`seek<class_AudioStreamPlayer3D_method_seek>`\ (\ to_position\: :ref:`float<class_float>`\ ) |
  89. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  90. | |void| | :ref:`stop<class_AudioStreamPlayer3D_method_stop>`\ (\ ) |
  91. +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+
  92. .. rst-class:: classref-section-separator
  93. ----
  94. .. rst-class:: classref-descriptions-group
  95. Signals
  96. -------
  97. .. _class_AudioStreamPlayer3D_signal_finished:
  98. .. rst-class:: classref-signal
  99. **finished**\ (\ ) :ref:`🔗<class_AudioStreamPlayer3D_signal_finished>`
  100. Emitted when the audio stops playing.
  101. .. rst-class:: classref-section-separator
  102. ----
  103. .. rst-class:: classref-descriptions-group
  104. Enumerations
  105. ------------
  106. .. _enum_AudioStreamPlayer3D_AttenuationModel:
  107. .. rst-class:: classref-enumeration
  108. enum **AttenuationModel**: :ref:`🔗<enum_AudioStreamPlayer3D_AttenuationModel>`
  109. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_INVERSE_DISTANCE:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **ATTENUATION_INVERSE_DISTANCE** = ``0``
  112. Attenuation of loudness according to linear distance.
  113. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_INVERSE_SQUARE_DISTANCE:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **ATTENUATION_INVERSE_SQUARE_DISTANCE** = ``1``
  116. Attenuation of loudness according to squared distance.
  117. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_LOGARITHMIC:
  118. .. rst-class:: classref-enumeration-constant
  119. :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **ATTENUATION_LOGARITHMIC** = ``2``
  120. Attenuation of loudness according to logarithmic distance.
  121. .. _class_AudioStreamPlayer3D_constant_ATTENUATION_DISABLED:
  122. .. rst-class:: classref-enumeration-constant
  123. :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **ATTENUATION_DISABLED** = ``3``
  124. No attenuation of loudness according to distance. The sound will still be heard positionally, unlike an :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`. :ref:`ATTENUATION_DISABLED<class_AudioStreamPlayer3D_constant_ATTENUATION_DISABLED>` can be combined with a :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` value greater than ``0.0`` to achieve linear attenuation clamped to a sphere of a defined size.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _enum_AudioStreamPlayer3D_DopplerTracking:
  128. .. rst-class:: classref-enumeration
  129. enum **DopplerTracking**: :ref:`🔗<enum_AudioStreamPlayer3D_DopplerTracking>`
  130. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_DISABLED:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **DOPPLER_TRACKING_DISABLED** = ``0``
  133. Disables doppler tracking.
  134. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_IDLE_STEP:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **DOPPLER_TRACKING_IDLE_STEP** = ``1``
  137. Executes doppler tracking during process frames (see :ref:`Node.NOTIFICATION_INTERNAL_PROCESS<class_Node_constant_NOTIFICATION_INTERNAL_PROCESS>`).
  138. .. _class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_PHYSICS_STEP:
  139. .. rst-class:: classref-enumeration-constant
  140. :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **DOPPLER_TRACKING_PHYSICS_STEP** = ``2``
  141. Executes doppler tracking during physics frames (see :ref:`Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_INTERNAL_PHYSICS_PROCESS>`).
  142. .. rst-class:: classref-section-separator
  143. ----
  144. .. rst-class:: classref-descriptions-group
  145. Property Descriptions
  146. ---------------------
  147. .. _class_AudioStreamPlayer3D_property_area_mask:
  148. .. rst-class:: classref-property
  149. :ref:`int<class_int>` **area_mask** = ``1`` :ref:`🔗<class_AudioStreamPlayer3D_property_area_mask>`
  150. .. rst-class:: classref-property-setget
  151. - |void| **set_area_mask**\ (\ value\: :ref:`int<class_int>`\ )
  152. - :ref:`int<class_int>` **get_area_mask**\ (\ )
  153. Determines which :ref:`Area3D<class_Area3D>` layers affect the sound for reverb and audio bus effects. Areas can be used to redirect :ref:`AudioStream<class_AudioStream>`\ s so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz:
  157. .. rst-class:: classref-property
  158. :ref:`float<class_float>` **attenuation_filter_cutoff_hz** = ``5000.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz>`
  159. .. rst-class:: classref-property-setget
  160. - |void| **set_attenuation_filter_cutoff_hz**\ (\ value\: :ref:`float<class_float>`\ )
  161. - :ref:`float<class_float>` **get_attenuation_filter_cutoff_hz**\ (\ )
  162. The cutoff frequency of the attenuation low-pass filter, in Hz. A sound above this frequency is attenuated more than a sound below this frequency. To disable this effect, set this to ``20500`` as this frequency is above the human hearing limit.
  163. .. rst-class:: classref-item-separator
  164. ----
  165. .. _class_AudioStreamPlayer3D_property_attenuation_filter_db:
  166. .. rst-class:: classref-property
  167. :ref:`float<class_float>` **attenuation_filter_db** = ``-24.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_attenuation_filter_db>`
  168. .. rst-class:: classref-property-setget
  169. - |void| **set_attenuation_filter_db**\ (\ value\: :ref:`float<class_float>`\ )
  170. - :ref:`float<class_float>` **get_attenuation_filter_db**\ (\ )
  171. Amount how much the filter affects the loudness, in decibels.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_AudioStreamPlayer3D_property_attenuation_model:
  175. .. rst-class:: classref-property
  176. :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **attenuation_model** = ``0`` :ref:`🔗<class_AudioStreamPlayer3D_property_attenuation_model>`
  177. .. rst-class:: classref-property-setget
  178. - |void| **set_attenuation_model**\ (\ value\: :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>`\ )
  179. - :ref:`AttenuationModel<enum_AudioStreamPlayer3D_AttenuationModel>` **get_attenuation_model**\ (\ )
  180. Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or not be affected by distance, effectively disabling attenuation.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_AudioStreamPlayer3D_property_autoplay:
  184. .. rst-class:: classref-property
  185. :ref:`bool<class_bool>` **autoplay** = ``false`` :ref:`🔗<class_AudioStreamPlayer3D_property_autoplay>`
  186. .. rst-class:: classref-property-setget
  187. - |void| **set_autoplay**\ (\ value\: :ref:`bool<class_bool>`\ )
  188. - :ref:`bool<class_bool>` **is_autoplay_enabled**\ (\ )
  189. If ``true``, audio plays when the AudioStreamPlayer3D node is added to scene tree.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_AudioStreamPlayer3D_property_bus:
  193. .. rst-class:: classref-property
  194. :ref:`StringName<class_StringName>` **bus** = ``&"Master"`` :ref:`🔗<class_AudioStreamPlayer3D_property_bus>`
  195. .. rst-class:: classref-property-setget
  196. - |void| **set_bus**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  197. - :ref:`StringName<class_StringName>` **get_bus**\ (\ )
  198. The bus on which this audio is playing.
  199. \ **Note:** When setting this property, keep in mind that no validation is performed to see if the given name matches an existing bus. This is because audio bus layouts might be loaded after this property is set. If this given name can't be resolved at runtime, it will fall back to ``"Master"``.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_AudioStreamPlayer3D_property_doppler_tracking:
  203. .. rst-class:: classref-property
  204. :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **doppler_tracking** = ``0`` :ref:`🔗<class_AudioStreamPlayer3D_property_doppler_tracking>`
  205. .. rst-class:: classref-property-setget
  206. - |void| **set_doppler_tracking**\ (\ value\: :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>`\ )
  207. - :ref:`DopplerTracking<enum_AudioStreamPlayer3D_DopplerTracking>` **get_doppler_tracking**\ (\ )
  208. Decides in which step the Doppler effect should be calculated.
  209. .. rst-class:: classref-item-separator
  210. ----
  211. .. _class_AudioStreamPlayer3D_property_emission_angle_degrees:
  212. .. rst-class:: classref-property
  213. :ref:`float<class_float>` **emission_angle_degrees** = ``45.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_emission_angle_degrees>`
  214. .. rst-class:: classref-property-setget
  215. - |void| **set_emission_angle**\ (\ value\: :ref:`float<class_float>`\ )
  216. - :ref:`float<class_float>` **get_emission_angle**\ (\ )
  217. The angle in which the audio reaches a listener unattenuated.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_AudioStreamPlayer3D_property_emission_angle_enabled:
  221. .. rst-class:: classref-property
  222. :ref:`bool<class_bool>` **emission_angle_enabled** = ``false`` :ref:`🔗<class_AudioStreamPlayer3D_property_emission_angle_enabled>`
  223. .. rst-class:: classref-property-setget
  224. - |void| **set_emission_angle_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  225. - :ref:`bool<class_bool>` **is_emission_angle_enabled**\ (\ )
  226. If ``true``, the audio should be attenuated according to the direction of the sound.
  227. .. rst-class:: classref-item-separator
  228. ----
  229. .. _class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db:
  230. .. rst-class:: classref-property
  231. :ref:`float<class_float>` **emission_angle_filter_attenuation_db** = ``-12.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_emission_angle_filter_attenuation_db>`
  232. .. rst-class:: classref-property-setget
  233. - |void| **set_emission_angle_filter_attenuation_db**\ (\ value\: :ref:`float<class_float>`\ )
  234. - :ref:`float<class_float>` **get_emission_angle_filter_attenuation_db**\ (\ )
  235. Attenuation factor used if listener 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, in decibels.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_AudioStreamPlayer3D_property_max_db:
  239. .. rst-class:: classref-property
  240. :ref:`float<class_float>` **max_db** = ``3.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_max_db>`
  241. .. rst-class:: classref-property-setget
  242. - |void| **set_max_db**\ (\ value\: :ref:`float<class_float>`\ )
  243. - :ref:`float<class_float>` **get_max_db**\ (\ )
  244. Sets the absolute maximum of the sound level, in decibels.
  245. .. rst-class:: classref-item-separator
  246. ----
  247. .. _class_AudioStreamPlayer3D_property_max_distance:
  248. .. rst-class:: classref-property
  249. :ref:`float<class_float>` **max_distance** = ``0.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_max_distance>`
  250. .. rst-class:: classref-property-setget
  251. - |void| **set_max_distance**\ (\ value\: :ref:`float<class_float>`\ )
  252. - :ref:`float<class_float>` **get_max_distance**\ (\ )
  253. The distance past which the sound can no longer be heard at all. Only has an effect if set to a value greater than ``0.0``. :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` works in tandem with :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>`. However, unlike :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>` whose behavior depends on the :ref:`attenuation_model<class_AudioStreamPlayer3D_property_attenuation_model>`, :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` always works in a linear fashion. This can be used to prevent the **AudioStreamPlayer3D** from requiring audio mixing when the listener is far away, which saves CPU resources.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_AudioStreamPlayer3D_property_max_polyphony:
  257. .. rst-class:: classref-property
  258. :ref:`int<class_int>` **max_polyphony** = ``1`` :ref:`🔗<class_AudioStreamPlayer3D_property_max_polyphony>`
  259. .. rst-class:: classref-property-setget
  260. - |void| **set_max_polyphony**\ (\ value\: :ref:`int<class_int>`\ )
  261. - :ref:`int<class_int>` **get_max_polyphony**\ (\ )
  262. The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.
  263. .. rst-class:: classref-item-separator
  264. ----
  265. .. _class_AudioStreamPlayer3D_property_panning_strength:
  266. .. rst-class:: classref-property
  267. :ref:`float<class_float>` **panning_strength** = ``1.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_panning_strength>`
  268. .. rst-class:: classref-property-setget
  269. - |void| **set_panning_strength**\ (\ value\: :ref:`float<class_float>`\ )
  270. - :ref:`float<class_float>` **get_panning_strength**\ (\ )
  271. Scales the panning strength for this node by multiplying the base :ref:`ProjectSettings.audio/general/3d_panning_strength<class_ProjectSettings_property_audio/general/3d_panning_strength>` with this factor. Higher values will pan audio from left to right more dramatically than lower values.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_AudioStreamPlayer3D_property_pitch_scale:
  275. .. rst-class:: classref-property
  276. :ref:`float<class_float>` **pitch_scale** = ``1.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_pitch_scale>`
  277. .. rst-class:: classref-property-setget
  278. - |void| **set_pitch_scale**\ (\ value\: :ref:`float<class_float>`\ )
  279. - :ref:`float<class_float>` **get_pitch_scale**\ (\ )
  280. The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_AudioStreamPlayer3D_property_playback_type:
  284. .. rst-class:: classref-property
  285. :ref:`PlaybackType<enum_AudioServer_PlaybackType>` **playback_type** = ``0`` :ref:`🔗<class_AudioStreamPlayer3D_property_playback_type>`
  286. .. rst-class:: classref-property-setget
  287. - |void| **set_playback_type**\ (\ value\: :ref:`PlaybackType<enum_AudioServer_PlaybackType>`\ )
  288. - :ref:`PlaybackType<enum_AudioServer_PlaybackType>` **get_playback_type**\ (\ )
  289. **Experimental:** This property may be changed or removed in future versions.
  290. The playback type of the stream player. If set other than to the default value, it will force that playback type.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_AudioStreamPlayer3D_property_playing:
  294. .. rst-class:: classref-property
  295. :ref:`bool<class_bool>` **playing** = ``false`` :ref:`🔗<class_AudioStreamPlayer3D_property_playing>`
  296. .. rst-class:: classref-property-setget
  297. - |void| **set_playing**\ (\ value\: :ref:`bool<class_bool>`\ )
  298. - :ref:`bool<class_bool>` **is_playing**\ (\ )
  299. If ``true``, audio is playing or is queued to be played (see :ref:`play()<class_AudioStreamPlayer3D_method_play>`).
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_AudioStreamPlayer3D_property_stream:
  303. .. rst-class:: classref-property
  304. :ref:`AudioStream<class_AudioStream>` **stream** :ref:`🔗<class_AudioStreamPlayer3D_property_stream>`
  305. .. rst-class:: classref-property-setget
  306. - |void| **set_stream**\ (\ value\: :ref:`AudioStream<class_AudioStream>`\ )
  307. - :ref:`AudioStream<class_AudioStream>` **get_stream**\ (\ )
  308. The :ref:`AudioStream<class_AudioStream>` resource to be played.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_AudioStreamPlayer3D_property_stream_paused:
  312. .. rst-class:: classref-property
  313. :ref:`bool<class_bool>` **stream_paused** = ``false`` :ref:`🔗<class_AudioStreamPlayer3D_property_stream_paused>`
  314. .. rst-class:: classref-property-setget
  315. - |void| **set_stream_paused**\ (\ value\: :ref:`bool<class_bool>`\ )
  316. - :ref:`bool<class_bool>` **get_stream_paused**\ (\ )
  317. If ``true``, the playback is paused. You can resume it by setting :ref:`stream_paused<class_AudioStreamPlayer3D_property_stream_paused>` to ``false``.
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _class_AudioStreamPlayer3D_property_unit_size:
  321. .. rst-class:: classref-property
  322. :ref:`float<class_float>` **unit_size** = ``10.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_unit_size>`
  323. .. rst-class:: classref-property-setget
  324. - |void| **set_unit_size**\ (\ value\: :ref:`float<class_float>`\ )
  325. - :ref:`float<class_float>` **get_unit_size**\ (\ )
  326. The factor for the attenuation effect. Higher values make the sound audible over a larger distance.
  327. .. rst-class:: classref-item-separator
  328. ----
  329. .. _class_AudioStreamPlayer3D_property_volume_db:
  330. .. rst-class:: classref-property
  331. :ref:`float<class_float>` **volume_db** = ``0.0`` :ref:`🔗<class_AudioStreamPlayer3D_property_volume_db>`
  332. .. rst-class:: classref-property-setget
  333. - |void| **set_volume_db**\ (\ value\: :ref:`float<class_float>`\ )
  334. - :ref:`float<class_float>` **get_volume_db**\ (\ )
  335. The base sound level before attenuation, in decibels.
  336. .. rst-class:: classref-item-separator
  337. ----
  338. .. _class_AudioStreamPlayer3D_property_volume_linear:
  339. .. rst-class:: classref-property
  340. :ref:`float<class_float>` **volume_linear** :ref:`🔗<class_AudioStreamPlayer3D_property_volume_linear>`
  341. .. rst-class:: classref-property-setget
  342. - |void| **set_volume_linear**\ (\ value\: :ref:`float<class_float>`\ )
  343. - :ref:`float<class_float>` **get_volume_linear**\ (\ )
  344. The base sound level before attenuation, as a linear value.
  345. \ **Note:** This member modifies :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` for convenience. The returned value is equivalent to the result of :ref:`@GlobalScope.db_to_linear()<class_@GlobalScope_method_db_to_linear>` on :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>`. Setting this member is equivalent to setting :ref:`volume_db<class_AudioStreamPlayer3D_property_volume_db>` to the result of :ref:`@GlobalScope.linear_to_db()<class_@GlobalScope_method_linear_to_db>` on a value.
  346. .. rst-class:: classref-section-separator
  347. ----
  348. .. rst-class:: classref-descriptions-group
  349. Method Descriptions
  350. -------------------
  351. .. _class_AudioStreamPlayer3D_method_get_playback_position:
  352. .. rst-class:: classref-method
  353. :ref:`float<class_float>` **get_playback_position**\ (\ ) :ref:`🔗<class_AudioStreamPlayer3D_method_get_playback_position>`
  354. Returns the position in the :ref:`AudioStream<class_AudioStream>`.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_AudioStreamPlayer3D_method_get_stream_playback:
  358. .. rst-class:: classref-method
  359. :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **get_stream_playback**\ (\ ) :ref:`🔗<class_AudioStreamPlayer3D_method_get_stream_playback>`
  360. Returns the :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` object associated with this **AudioStreamPlayer3D**.
  361. .. rst-class:: classref-item-separator
  362. ----
  363. .. _class_AudioStreamPlayer3D_method_has_stream_playback:
  364. .. rst-class:: classref-method
  365. :ref:`bool<class_bool>` **has_stream_playback**\ (\ ) :ref:`🔗<class_AudioStreamPlayer3D_method_has_stream_playback>`
  366. Returns whether the :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` can return the :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` object or not.
  367. .. rst-class:: classref-item-separator
  368. ----
  369. .. _class_AudioStreamPlayer3D_method_play:
  370. .. rst-class:: classref-method
  371. |void| **play**\ (\ from_position\: :ref:`float<class_float>` = 0.0\ ) :ref:`🔗<class_AudioStreamPlayer3D_method_play>`
  372. Queues the audio to play on the next physics frame, from the given position ``from_position``, in seconds.
  373. .. rst-class:: classref-item-separator
  374. ----
  375. .. _class_AudioStreamPlayer3D_method_seek:
  376. .. rst-class:: classref-method
  377. |void| **seek**\ (\ to_position\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AudioStreamPlayer3D_method_seek>`
  378. Sets the position from which audio will be played, in seconds.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_AudioStreamPlayer3D_method_stop:
  382. .. rst-class:: classref-method
  383. |void| **stop**\ (\ ) :ref:`🔗<class_AudioStreamPlayer3D_method_stop>`
  384. Stops the audio.
  385. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  386. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  387. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  388. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  389. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  390. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  391. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  392. .. |void| replace:: :abbr:`void (No return value.)`