class_audioserver.rst 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioServer.xml.
  6. .. _class_AudioServer:
  7. AudioServer
  8. ===========
  9. **Inherits:** :ref:`Object<class_Object>`
  10. Server interface for low-level audio access.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **AudioServer** is a low-level server interface for audio access. It is in charge of creating sample data (playable audio) as well as its playback via a voice interface.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`Audio buses <../tutorials/audio/audio_buses>`
  19. - `Audio Device Changer Demo <https://godotengine.org/asset-library/asset/2758>`__
  20. - `Audio Microphone Record Demo <https://godotengine.org/asset-library/asset/2760>`__
  21. - `Audio Spectrum Visualizer Demo <https://godotengine.org/asset-library/asset/2762>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +-----------------------------+------------------------------------------------------------------------------+---------------+
  28. | :ref:`int<class_int>` | :ref:`bus_count<class_AudioServer_property_bus_count>` | ``1`` |
  29. +-----------------------------+------------------------------------------------------------------------------+---------------+
  30. | :ref:`String<class_String>` | :ref:`input_device<class_AudioServer_property_input_device>` | ``"Default"`` |
  31. +-----------------------------+------------------------------------------------------------------------------+---------------+
  32. | :ref:`String<class_String>` | :ref:`output_device<class_AudioServer_property_output_device>` | ``"Default"`` |
  33. +-----------------------------+------------------------------------------------------------------------------+---------------+
  34. | :ref:`float<class_float>` | :ref:`playback_speed_scale<class_AudioServer_property_playback_speed_scale>` | ``1.0`` |
  35. +-----------------------------+------------------------------------------------------------------------------+---------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | |void| | :ref:`add_bus<class_AudioServer_method_add_bus>`\ (\ at_position\: :ref:`int<class_int>` = -1\ ) |
  43. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | |void| | :ref:`add_bus_effect<class_AudioServer_method_add_bus_effect>`\ (\ bus_idx\: :ref:`int<class_int>`, effect\: :ref:`AudioEffect<class_AudioEffect>`, at_position\: :ref:`int<class_int>` = -1\ ) |
  45. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`AudioBusLayout<class_AudioBusLayout>` | :ref:`generate_bus_layout<class_AudioServer_method_generate_bus_layout>`\ (\ ) |const| |
  47. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_bus_channels<class_AudioServer_method_get_bus_channels>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  49. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`AudioEffect<class_AudioEffect>` | :ref:`get_bus_effect<class_AudioServer_method_get_bus_effect>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) |
  51. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`get_bus_effect_count<class_AudioServer_method_get_bus_effect_count>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |
  53. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`AudioEffectInstance<class_AudioEffectInstance>` | :ref:`get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>` = 0\ ) |
  55. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`int<class_int>` | :ref:`get_bus_index<class_AudioServer_method_get_bus_index>`\ (\ bus_name\: :ref:`StringName<class_StringName>`\ ) |const| |
  57. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`String<class_String>` | :ref:`get_bus_name<class_AudioServer_method_get_bus_name>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  59. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`float<class_float>` | :ref:`get_bus_peak_volume_left_db<class_AudioServer_method_get_bus_peak_volume_left_db>`\ (\ bus_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>`\ ) |const| |
  61. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`float<class_float>` | :ref:`get_bus_peak_volume_right_db<class_AudioServer_method_get_bus_peak_volume_right_db>`\ (\ bus_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>`\ ) |const| |
  63. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`StringName<class_StringName>` | :ref:`get_bus_send<class_AudioServer_method_get_bus_send>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  65. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`float<class_float>` | :ref:`get_bus_volume_db<class_AudioServer_method_get_bus_volume_db>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  67. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`String<class_String>` | :ref:`get_driver_name<class_AudioServer_method_get_driver_name>`\ (\ ) |const| |
  69. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_input_device_list<class_AudioServer_method_get_input_device_list>`\ (\ ) |
  71. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`float<class_float>` | :ref:`get_input_mix_rate<class_AudioServer_method_get_input_mix_rate>`\ (\ ) |const| |
  73. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`float<class_float>` | :ref:`get_mix_rate<class_AudioServer_method_get_mix_rate>`\ (\ ) |const| |
  75. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_output_device_list<class_AudioServer_method_get_output_device_list>`\ (\ ) |
  77. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`float<class_float>` | :ref:`get_output_latency<class_AudioServer_method_get_output_latency>`\ (\ ) |const| |
  79. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` | :ref:`get_speaker_mode<class_AudioServer_method_get_speaker_mode>`\ (\ ) |const| |
  81. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`float<class_float>` | :ref:`get_time_since_last_mix<class_AudioServer_method_get_time_since_last_mix>`\ (\ ) |const| |
  83. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`float<class_float>` | :ref:`get_time_to_next_mix<class_AudioServer_method_get_time_to_next_mix>`\ (\ ) |const| |
  85. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`bool<class_bool>` | :ref:`is_bus_bypassing_effects<class_AudioServer_method_is_bus_bypassing_effects>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  87. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`bool<class_bool>` | :ref:`is_bus_effect_enabled<class_AudioServer_method_is_bus_effect_enabled>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) |const| |
  89. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`bool<class_bool>` | :ref:`is_bus_mute<class_AudioServer_method_is_bus_mute>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  91. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`is_bus_solo<class_AudioServer_method_is_bus_solo>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
  93. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`bool<class_bool>` | :ref:`is_stream_registered_as_sample<class_AudioServer_method_is_stream_registered_as_sample>`\ (\ stream\: :ref:`AudioStream<class_AudioStream>`\ ) |
  95. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | |void| | :ref:`lock<class_AudioServer_method_lock>`\ (\ ) |
  97. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | |void| | :ref:`move_bus<class_AudioServer_method_move_bus>`\ (\ index\: :ref:`int<class_int>`, to_index\: :ref:`int<class_int>`\ ) |
  99. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | |void| | :ref:`register_stream_as_sample<class_AudioServer_method_register_stream_as_sample>`\ (\ stream\: :ref:`AudioStream<class_AudioStream>`\ ) |
  101. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | |void| | :ref:`remove_bus<class_AudioServer_method_remove_bus>`\ (\ index\: :ref:`int<class_int>`\ ) |
  103. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | |void| | :ref:`remove_bus_effect<class_AudioServer_method_remove_bus_effect>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) |
  105. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | |void| | :ref:`set_bus_bypass_effects<class_AudioServer_method_set_bus_bypass_effects>`\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  107. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | |void| | :ref:`set_bus_effect_enabled<class_AudioServer_method_set_bus_effect_enabled>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ ) |
  109. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | |void| | :ref:`set_bus_layout<class_AudioServer_method_set_bus_layout>`\ (\ bus_layout\: :ref:`AudioBusLayout<class_AudioBusLayout>`\ ) |
  111. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | |void| | :ref:`set_bus_mute<class_AudioServer_method_set_bus_mute>`\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  113. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | |void| | :ref:`set_bus_name<class_AudioServer_method_set_bus_name>`\ (\ bus_idx\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) |
  115. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | |void| | :ref:`set_bus_send<class_AudioServer_method_set_bus_send>`\ (\ bus_idx\: :ref:`int<class_int>`, send\: :ref:`StringName<class_StringName>`\ ) |
  117. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | |void| | :ref:`set_bus_solo<class_AudioServer_method_set_bus_solo>`\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  119. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | |void| | :ref:`set_bus_volume_db<class_AudioServer_method_set_bus_volume_db>`\ (\ bus_idx\: :ref:`int<class_int>`, volume_db\: :ref:`float<class_float>`\ ) |
  121. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | |void| | :ref:`set_enable_tagging_used_audio_streams<class_AudioServer_method_set_enable_tagging_used_audio_streams>`\ (\ enable\: :ref:`bool<class_bool>`\ ) |
  123. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | |void| | :ref:`swap_bus_effects<class_AudioServer_method_swap_bus_effects>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, by_effect_idx\: :ref:`int<class_int>`\ ) |
  125. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | |void| | :ref:`unlock<class_AudioServer_method_unlock>`\ (\ ) |
  127. +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. .. rst-class:: classref-section-separator
  129. ----
  130. .. rst-class:: classref-descriptions-group
  131. Signals
  132. -------
  133. .. _class_AudioServer_signal_bus_layout_changed:
  134. .. rst-class:: classref-signal
  135. **bus_layout_changed**\ (\ ) :ref:`🔗<class_AudioServer_signal_bus_layout_changed>`
  136. Emitted when an audio bus is added, deleted, or moved.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_AudioServer_signal_bus_renamed:
  140. .. rst-class:: classref-signal
  141. **bus_renamed**\ (\ bus_index\: :ref:`int<class_int>`, old_name\: :ref:`StringName<class_StringName>`, new_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AudioServer_signal_bus_renamed>`
  142. Emitted when the audio bus at ``bus_index`` is renamed from ``old_name`` to ``new_name``.
  143. .. rst-class:: classref-section-separator
  144. ----
  145. .. rst-class:: classref-descriptions-group
  146. Enumerations
  147. ------------
  148. .. _enum_AudioServer_SpeakerMode:
  149. .. rst-class:: classref-enumeration
  150. enum **SpeakerMode**: :ref:`🔗<enum_AudioServer_SpeakerMode>`
  151. .. _class_AudioServer_constant_SPEAKER_MODE_STEREO:
  152. .. rst-class:: classref-enumeration-constant
  153. :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_MODE_STEREO** = ``0``
  154. Two or fewer speakers were detected.
  155. .. _class_AudioServer_constant_SPEAKER_SURROUND_31:
  156. .. rst-class:: classref-enumeration-constant
  157. :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_SURROUND_31** = ``1``
  158. A 3.1 channel surround setup was detected.
  159. .. _class_AudioServer_constant_SPEAKER_SURROUND_51:
  160. .. rst-class:: classref-enumeration-constant
  161. :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_SURROUND_51** = ``2``
  162. A 5.1 channel surround setup was detected.
  163. .. _class_AudioServer_constant_SPEAKER_SURROUND_71:
  164. .. rst-class:: classref-enumeration-constant
  165. :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_SURROUND_71** = ``3``
  166. A 7.1 channel surround setup was detected.
  167. .. rst-class:: classref-item-separator
  168. ----
  169. .. _enum_AudioServer_PlaybackType:
  170. .. rst-class:: classref-enumeration
  171. enum **PlaybackType**: :ref:`🔗<enum_AudioServer_PlaybackType>`
  172. .. _class_AudioServer_constant_PLAYBACK_TYPE_DEFAULT:
  173. .. rst-class:: classref-enumeration-constant
  174. :ref:`PlaybackType<enum_AudioServer_PlaybackType>` **PLAYBACK_TYPE_DEFAULT** = ``0``
  175. **Experimental:** This constant may be changed or removed in future versions.
  176. The playback will be considered of the type declared at :ref:`ProjectSettings.audio/general/default_playback_type<class_ProjectSettings_property_audio/general/default_playback_type>`.
  177. .. _class_AudioServer_constant_PLAYBACK_TYPE_STREAM:
  178. .. rst-class:: classref-enumeration-constant
  179. :ref:`PlaybackType<enum_AudioServer_PlaybackType>` **PLAYBACK_TYPE_STREAM** = ``1``
  180. **Experimental:** This constant may be changed or removed in future versions.
  181. Force the playback to be considered as a stream.
  182. .. _class_AudioServer_constant_PLAYBACK_TYPE_SAMPLE:
  183. .. rst-class:: classref-enumeration-constant
  184. :ref:`PlaybackType<enum_AudioServer_PlaybackType>` **PLAYBACK_TYPE_SAMPLE** = ``2``
  185. **Experimental:** This constant may be changed or removed in future versions.
  186. Force the playback to be considered as a sample. This can provide lower latency and more stable playback (with less risk of audio crackling), at the cost of having less flexibility.
  187. \ **Note:** Only currently supported on the web platform.
  188. \ **Note:** :ref:`AudioEffect<class_AudioEffect>`\ s are not supported when playback is considered as a sample.
  189. .. _class_AudioServer_constant_PLAYBACK_TYPE_MAX:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`PlaybackType<enum_AudioServer_PlaybackType>` **PLAYBACK_TYPE_MAX** = ``3``
  192. **Experimental:** This constant may be changed or removed in future versions.
  193. Represents the size of the :ref:`PlaybackType<enum_AudioServer_PlaybackType>` enum.
  194. .. rst-class:: classref-section-separator
  195. ----
  196. .. rst-class:: classref-descriptions-group
  197. Property Descriptions
  198. ---------------------
  199. .. _class_AudioServer_property_bus_count:
  200. .. rst-class:: classref-property
  201. :ref:`int<class_int>` **bus_count** = ``1`` :ref:`🔗<class_AudioServer_property_bus_count>`
  202. .. rst-class:: classref-property-setget
  203. - |void| **set_bus_count**\ (\ value\: :ref:`int<class_int>`\ )
  204. - :ref:`int<class_int>` **get_bus_count**\ (\ )
  205. Number of available audio buses.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_AudioServer_property_input_device:
  209. .. rst-class:: classref-property
  210. :ref:`String<class_String>` **input_device** = ``"Default"`` :ref:`🔗<class_AudioServer_property_input_device>`
  211. .. rst-class:: classref-property-setget
  212. - |void| **set_input_device**\ (\ value\: :ref:`String<class_String>`\ )
  213. - :ref:`String<class_String>` **get_input_device**\ (\ )
  214. Name of the current device for audio input (see :ref:`get_input_device_list<class_AudioServer_method_get_input_device_list>`). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value ``"Default"`` will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to ``"Default"``.
  215. \ **Note:** :ref:`ProjectSettings.audio/driver/enable_input<class_ProjectSettings_property_audio/driver/enable_input>` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_AudioServer_property_output_device:
  219. .. rst-class:: classref-property
  220. :ref:`String<class_String>` **output_device** = ``"Default"`` :ref:`🔗<class_AudioServer_property_output_device>`
  221. .. rst-class:: classref-property-setget
  222. - |void| **set_output_device**\ (\ value\: :ref:`String<class_String>`\ )
  223. - :ref:`String<class_String>` **get_output_device**\ (\ )
  224. Name of the current device for audio output (see :ref:`get_output_device_list<class_AudioServer_method_get_output_device_list>`). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value ``"Default"`` will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to ``"Default"``.
  225. .. rst-class:: classref-item-separator
  226. ----
  227. .. _class_AudioServer_property_playback_speed_scale:
  228. .. rst-class:: classref-property
  229. :ref:`float<class_float>` **playback_speed_scale** = ``1.0`` :ref:`🔗<class_AudioServer_property_playback_speed_scale>`
  230. .. rst-class:: classref-property-setget
  231. - |void| **set_playback_speed_scale**\ (\ value\: :ref:`float<class_float>`\ )
  232. - :ref:`float<class_float>` **get_playback_speed_scale**\ (\ )
  233. Scales the rate at which audio is played (i.e. setting it to ``0.5`` will make the audio be played at half its speed). See also :ref:`Engine.time_scale<class_Engine_property_time_scale>` to affect the general simulation speed, which is independent from :ref:`playback_speed_scale<class_AudioServer_property_playback_speed_scale>`.
  234. .. rst-class:: classref-section-separator
  235. ----
  236. .. rst-class:: classref-descriptions-group
  237. Method Descriptions
  238. -------------------
  239. .. _class_AudioServer_method_add_bus:
  240. .. rst-class:: classref-method
  241. |void| **add_bus**\ (\ at_position\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_AudioServer_method_add_bus>`
  242. Adds a bus at ``at_position``.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_AudioServer_method_add_bus_effect:
  246. .. rst-class:: classref-method
  247. |void| **add_bus_effect**\ (\ bus_idx\: :ref:`int<class_int>`, effect\: :ref:`AudioEffect<class_AudioEffect>`, at_position\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_AudioServer_method_add_bus_effect>`
  248. Adds an :ref:`AudioEffect<class_AudioEffect>` effect to the bus ``bus_idx`` at ``at_position``.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_AudioServer_method_generate_bus_layout:
  252. .. rst-class:: classref-method
  253. :ref:`AudioBusLayout<class_AudioBusLayout>` **generate_bus_layout**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_generate_bus_layout>`
  254. Generates an :ref:`AudioBusLayout<class_AudioBusLayout>` using the available buses and effects.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_AudioServer_method_get_bus_channels:
  258. .. rst-class:: classref-method
  259. :ref:`int<class_int>` **get_bus_channels**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_channels>`
  260. Returns the number of channels of the bus at index ``bus_idx``.
  261. .. rst-class:: classref-item-separator
  262. ----
  263. .. _class_AudioServer_method_get_bus_effect:
  264. .. rst-class:: classref-method
  265. :ref:`AudioEffect<class_AudioEffect>` **get_bus_effect**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioServer_method_get_bus_effect>`
  266. Returns the :ref:`AudioEffect<class_AudioEffect>` at position ``effect_idx`` in bus ``bus_idx``.
  267. .. rst-class:: classref-item-separator
  268. ----
  269. .. _class_AudioServer_method_get_bus_effect_count:
  270. .. rst-class:: classref-method
  271. :ref:`int<class_int>` **get_bus_effect_count**\ (\ bus_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioServer_method_get_bus_effect_count>`
  272. Returns the number of effects on the bus at ``bus_idx``.
  273. .. rst-class:: classref-item-separator
  274. ----
  275. .. _class_AudioServer_method_get_bus_effect_instance:
  276. .. rst-class:: classref-method
  277. :ref:`AudioEffectInstance<class_AudioEffectInstance>` **get_bus_effect_instance**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_AudioServer_method_get_bus_effect_instance>`
  278. Returns the :ref:`AudioEffectInstance<class_AudioEffectInstance>` assigned to the given bus and effect indices (and optionally channel).
  279. .. rst-class:: classref-item-separator
  280. ----
  281. .. _class_AudioServer_method_get_bus_index:
  282. .. rst-class:: classref-method
  283. :ref:`int<class_int>` **get_bus_index**\ (\ bus_name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_index>`
  284. Returns the index of the bus with the name ``bus_name``. Returns ``-1`` if no bus with the specified name exist.
  285. .. rst-class:: classref-item-separator
  286. ----
  287. .. _class_AudioServer_method_get_bus_name:
  288. .. rst-class:: classref-method
  289. :ref:`String<class_String>` **get_bus_name**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_name>`
  290. Returns the name of the bus with the index ``bus_idx``.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_AudioServer_method_get_bus_peak_volume_left_db:
  294. .. rst-class:: classref-method
  295. :ref:`float<class_float>` **get_bus_peak_volume_left_db**\ (\ bus_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_peak_volume_left_db>`
  296. Returns the peak volume of the left speaker at bus index ``bus_idx`` and channel index ``channel``.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _class_AudioServer_method_get_bus_peak_volume_right_db:
  300. .. rst-class:: classref-method
  301. :ref:`float<class_float>` **get_bus_peak_volume_right_db**\ (\ bus_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_peak_volume_right_db>`
  302. Returns the peak volume of the right speaker at bus index ``bus_idx`` and channel index ``channel``.
  303. .. rst-class:: classref-item-separator
  304. ----
  305. .. _class_AudioServer_method_get_bus_send:
  306. .. rst-class:: classref-method
  307. :ref:`StringName<class_StringName>` **get_bus_send**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_send>`
  308. Returns the name of the bus that the bus at index ``bus_idx`` sends to.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_AudioServer_method_get_bus_volume_db:
  312. .. rst-class:: classref-method
  313. :ref:`float<class_float>` **get_bus_volume_db**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_get_bus_volume_db>`
  314. Returns the volume of the bus at index ``bus_idx`` in dB.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_AudioServer_method_get_driver_name:
  318. .. rst-class:: classref-method
  319. :ref:`String<class_String>` **get_driver_name**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_driver_name>`
  320. Returns the name of the current audio driver. The default usually depends on the operating system, but may be overridden via the ``--audio-driver`` :doc:`command line argument <../tutorials/editor/command_line_tutorial>`. ``--headless`` also automatically sets the audio driver to ``Dummy``. See also :ref:`ProjectSettings.audio/driver/driver<class_ProjectSettings_property_audio/driver/driver>`.
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_AudioServer_method_get_input_device_list:
  324. .. rst-class:: classref-method
  325. :ref:`PackedStringArray<class_PackedStringArray>` **get_input_device_list**\ (\ ) :ref:`🔗<class_AudioServer_method_get_input_device_list>`
  326. Returns the names of all audio input devices detected on the system.
  327. \ **Note:** :ref:`ProjectSettings.audio/driver/enable_input<class_ProjectSettings_property_audio/driver/enable_input>` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_AudioServer_method_get_input_mix_rate:
  331. .. rst-class:: classref-method
  332. :ref:`float<class_float>` **get_input_mix_rate**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_input_mix_rate>`
  333. Returns the sample rate at the input of the **AudioServer**.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_AudioServer_method_get_mix_rate:
  337. .. rst-class:: classref-method
  338. :ref:`float<class_float>` **get_mix_rate**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_mix_rate>`
  339. Returns the sample rate at the output of the **AudioServer**.
  340. .. rst-class:: classref-item-separator
  341. ----
  342. .. _class_AudioServer_method_get_output_device_list:
  343. .. rst-class:: classref-method
  344. :ref:`PackedStringArray<class_PackedStringArray>` **get_output_device_list**\ (\ ) :ref:`🔗<class_AudioServer_method_get_output_device_list>`
  345. Returns the names of all audio output devices detected on the system.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_AudioServer_method_get_output_latency:
  349. .. rst-class:: classref-method
  350. :ref:`float<class_float>` **get_output_latency**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_output_latency>`
  351. Returns the audio driver's effective output latency. This is based on :ref:`ProjectSettings.audio/driver/output_latency<class_ProjectSettings_property_audio/driver/output_latency>`, but the exact returned value will differ depending on the operating system and audio driver.
  352. \ **Note:** This can be expensive; it is not recommended to call :ref:`get_output_latency<class_AudioServer_method_get_output_latency>` every frame.
  353. .. rst-class:: classref-item-separator
  354. ----
  355. .. _class_AudioServer_method_get_speaker_mode:
  356. .. rst-class:: classref-method
  357. :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **get_speaker_mode**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_speaker_mode>`
  358. Returns the speaker configuration.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_AudioServer_method_get_time_since_last_mix:
  362. .. rst-class:: classref-method
  363. :ref:`float<class_float>` **get_time_since_last_mix**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_time_since_last_mix>`
  364. Returns the relative time since the last mix occurred.
  365. .. rst-class:: classref-item-separator
  366. ----
  367. .. _class_AudioServer_method_get_time_to_next_mix:
  368. .. rst-class:: classref-method
  369. :ref:`float<class_float>` **get_time_to_next_mix**\ (\ ) |const| :ref:`🔗<class_AudioServer_method_get_time_to_next_mix>`
  370. Returns the relative time until the next mix occurs.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_AudioServer_method_is_bus_bypassing_effects:
  374. .. rst-class:: classref-method
  375. :ref:`bool<class_bool>` **is_bus_bypassing_effects**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_is_bus_bypassing_effects>`
  376. If ``true``, the bus at index ``bus_idx`` is bypassing effects.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_AudioServer_method_is_bus_effect_enabled:
  380. .. rst-class:: classref-method
  381. :ref:`bool<class_bool>` **is_bus_effect_enabled**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_is_bus_effect_enabled>`
  382. If ``true``, the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_AudioServer_method_is_bus_mute:
  386. .. rst-class:: classref-method
  387. :ref:`bool<class_bool>` **is_bus_mute**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_is_bus_mute>`
  388. If ``true``, the bus at index ``bus_idx`` is muted.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_AudioServer_method_is_bus_solo:
  392. .. rst-class:: classref-method
  393. :ref:`bool<class_bool>` **is_bus_solo**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioServer_method_is_bus_solo>`
  394. If ``true``, the bus at index ``bus_idx`` is in solo mode.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_AudioServer_method_is_stream_registered_as_sample:
  398. .. rst-class:: classref-method
  399. :ref:`bool<class_bool>` **is_stream_registered_as_sample**\ (\ stream\: :ref:`AudioStream<class_AudioStream>`\ ) :ref:`🔗<class_AudioServer_method_is_stream_registered_as_sample>`
  400. **Experimental:** This method may be changed or removed in future versions.
  401. If ``true``, the stream is registered as a sample. The engine will not have to register it before playing the sample.
  402. If ``false``, the stream will have to be registered before playing it. To prevent lag spikes, register the stream as sample with :ref:`register_stream_as_sample<class_AudioServer_method_register_stream_as_sample>`.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_AudioServer_method_lock:
  406. .. rst-class:: classref-method
  407. |void| **lock**\ (\ ) :ref:`🔗<class_AudioServer_method_lock>`
  408. Locks the audio driver's main loop.
  409. \ **Note:** Remember to unlock it afterwards.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_AudioServer_method_move_bus:
  413. .. rst-class:: classref-method
  414. |void| **move_bus**\ (\ index\: :ref:`int<class_int>`, to_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioServer_method_move_bus>`
  415. Moves the bus from index ``index`` to index ``to_index``.
  416. .. rst-class:: classref-item-separator
  417. ----
  418. .. _class_AudioServer_method_register_stream_as_sample:
  419. .. rst-class:: classref-method
  420. |void| **register_stream_as_sample**\ (\ stream\: :ref:`AudioStream<class_AudioStream>`\ ) :ref:`🔗<class_AudioServer_method_register_stream_as_sample>`
  421. **Experimental:** This method may be changed or removed in future versions.
  422. Forces the registration of a stream as a sample.
  423. \ **Note:** Lag spikes may occur when calling this method, especially on single-threaded builds. It is suggested to call this method while loading assets, where the lag spike could be masked, instead of registering the sample right before it needs to be played.
  424. .. rst-class:: classref-item-separator
  425. ----
  426. .. _class_AudioServer_method_remove_bus:
  427. .. rst-class:: classref-method
  428. |void| **remove_bus**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioServer_method_remove_bus>`
  429. Removes the bus at index ``index``.
  430. .. rst-class:: classref-item-separator
  431. ----
  432. .. _class_AudioServer_method_remove_bus_effect:
  433. .. rst-class:: classref-method
  434. |void| **remove_bus_effect**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioServer_method_remove_bus_effect>`
  435. Removes the effect at index ``effect_idx`` from the bus at index ``bus_idx``.
  436. .. rst-class:: classref-item-separator
  437. ----
  438. .. _class_AudioServer_method_set_bus_bypass_effects:
  439. .. rst-class:: classref-method
  440. |void| **set_bus_bypass_effects**\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_bypass_effects>`
  441. If ``true``, the bus at index ``bus_idx`` is bypassing effects.
  442. .. rst-class:: classref-item-separator
  443. ----
  444. .. _class_AudioServer_method_set_bus_effect_enabled:
  445. .. rst-class:: classref-method
  446. |void| **set_bus_effect_enabled**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_effect_enabled>`
  447. If ``true``, the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled.
  448. .. rst-class:: classref-item-separator
  449. ----
  450. .. _class_AudioServer_method_set_bus_layout:
  451. .. rst-class:: classref-method
  452. |void| **set_bus_layout**\ (\ bus_layout\: :ref:`AudioBusLayout<class_AudioBusLayout>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_layout>`
  453. Overwrites the currently used :ref:`AudioBusLayout<class_AudioBusLayout>`.
  454. .. rst-class:: classref-item-separator
  455. ----
  456. .. _class_AudioServer_method_set_bus_mute:
  457. .. rst-class:: classref-method
  458. |void| **set_bus_mute**\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_mute>`
  459. If ``true``, the bus at index ``bus_idx`` is muted.
  460. .. rst-class:: classref-item-separator
  461. ----
  462. .. _class_AudioServer_method_set_bus_name:
  463. .. rst-class:: classref-method
  464. |void| **set_bus_name**\ (\ bus_idx\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_name>`
  465. Sets the name of the bus at index ``bus_idx`` to ``name``.
  466. .. rst-class:: classref-item-separator
  467. ----
  468. .. _class_AudioServer_method_set_bus_send:
  469. .. rst-class:: classref-method
  470. |void| **set_bus_send**\ (\ bus_idx\: :ref:`int<class_int>`, send\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_send>`
  471. Connects the output of the bus at ``bus_idx`` to the bus named ``send``.
  472. .. rst-class:: classref-item-separator
  473. ----
  474. .. _class_AudioServer_method_set_bus_solo:
  475. .. rst-class:: classref-method
  476. |void| **set_bus_solo**\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_solo>`
  477. If ``true``, the bus at index ``bus_idx`` is in solo mode.
  478. .. rst-class:: classref-item-separator
  479. ----
  480. .. _class_AudioServer_method_set_bus_volume_db:
  481. .. rst-class:: classref-method
  482. |void| **set_bus_volume_db**\ (\ bus_idx\: :ref:`int<class_int>`, volume_db\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AudioServer_method_set_bus_volume_db>`
  483. Sets the volume of the bus at index ``bus_idx`` to ``volume_db``.
  484. .. rst-class:: classref-item-separator
  485. ----
  486. .. _class_AudioServer_method_set_enable_tagging_used_audio_streams:
  487. .. rst-class:: classref-method
  488. |void| **set_enable_tagging_used_audio_streams**\ (\ enable\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_AudioServer_method_set_enable_tagging_used_audio_streams>`
  489. If set to ``true``, all instances of :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` will call :ref:`AudioStreamPlayback._tag_used_streams<class_AudioStreamPlayback_private_method__tag_used_streams>` every mix step.
  490. \ **Note:** This is enabled by default in the editor, as it is used by editor plugins for the audio stream previews.
  491. .. rst-class:: classref-item-separator
  492. ----
  493. .. _class_AudioServer_method_swap_bus_effects:
  494. .. rst-class:: classref-method
  495. |void| **swap_bus_effects**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, by_effect_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioServer_method_swap_bus_effects>`
  496. Swaps the position of two effects in bus ``bus_idx``.
  497. .. rst-class:: classref-item-separator
  498. ----
  499. .. _class_AudioServer_method_unlock:
  500. .. rst-class:: classref-method
  501. |void| **unlock**\ (\ ) :ref:`🔗<class_AudioServer_method_unlock>`
  502. Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)
  503. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  504. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  505. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  506. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  507. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  508. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  509. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  510. .. |void| replace:: :abbr:`void (No return value.)`