Files
godot-docs/classes/class_audioserver.rst
2024-02-24 03:20:02 +00:00

783 lines
40 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioServer.xml.
.. _class_AudioServer:
AudioServer
===========
**Inherits:** :ref:`Object<class_Object>`
Server interface for low-level audio access.
.. rst-class:: classref-introduction-group
Description
-----------
**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.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`Audio buses <../tutorials/audio/audio_buses>`
- `Audio Device Changer Demo <https://godotengine.org/asset-library/asset/525>`__
- `Audio Mic Record Demo <https://godotengine.org/asset-library/asset/527>`__
- `Audio Spectrum Demo <https://godotengine.org/asset-library/asset/528>`__
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------+------------------------------------------------------------------------------+---------------+
| :ref:`int<class_int>` | :ref:`bus_count<class_AudioServer_property_bus_count>` | ``1`` |
+-----------------------------+------------------------------------------------------------------------------+---------------+
| :ref:`String<class_String>` | :ref:`input_device<class_AudioServer_property_input_device>` | ``"Default"`` |
+-----------------------------+------------------------------------------------------------------------------+---------------+
| :ref:`String<class_String>` | :ref:`output_device<class_AudioServer_property_output_device>` | ``"Default"`` |
+-----------------------------+------------------------------------------------------------------------------+---------------+
| :ref:`float<class_float>` | :ref:`playback_speed_scale<class_AudioServer_property_playback_speed_scale>` | ``1.0`` |
+-----------------------------+------------------------------------------------------------------------------+---------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_bus<class_AudioServer_method_add_bus>`\ (\ at_position\: :ref:`int<class_int>` = -1\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |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\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AudioBusLayout<class_AudioBusLayout>` | :ref:`generate_bus_layout<class_AudioServer_method_generate_bus_layout>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_bus_channels<class_AudioServer_method_get_bus_channels>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_bus_effect_count<class_AudioServer_method_get_bus_effect_count>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_bus_index<class_AudioServer_method_get_bus_index>`\ (\ bus_name\: :ref:`StringName<class_StringName>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_bus_name<class_AudioServer_method_get_bus_name>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`get_bus_send<class_AudioServer_method_get_bus_send>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_bus_volume_db<class_AudioServer_method_get_bus_volume_db>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_input_device_list<class_AudioServer_method_get_input_device_list>`\ (\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_mix_rate<class_AudioServer_method_get_mix_rate>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_output_device_list<class_AudioServer_method_get_output_device_list>`\ (\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_output_latency<class_AudioServer_method_get_output_latency>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` | :ref:`get_speaker_mode<class_AudioServer_method_get_speaker_mode>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_time_since_last_mix<class_AudioServer_method_get_time_since_last_mix>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_time_to_next_mix<class_AudioServer_method_get_time_to_next_mix>`\ (\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_bus_bypassing_effects<class_AudioServer_method_is_bus_bypassing_effects>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :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| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_bus_mute<class_AudioServer_method_is_bus_mute>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_bus_solo<class_AudioServer_method_is_bus_solo>`\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`lock<class_AudioServer_method_lock>`\ (\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`move_bus<class_AudioServer_method_move_bus>`\ (\ index\: :ref:`int<class_int>`, to_index\: :ref:`int<class_int>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_bus<class_AudioServer_method_remove_bus>`\ (\ index\: :ref:`int<class_int>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_bus_effect<class_AudioServer_method_remove_bus_effect>`\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_bypass_effects<class_AudioServer_method_set_bus_bypass_effects>`\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |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>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_layout<class_AudioServer_method_set_bus_layout>`\ (\ bus_layout\: :ref:`AudioBusLayout<class_AudioBusLayout>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_mute<class_AudioServer_method_set_bus_mute>`\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_name<class_AudioServer_method_set_bus_name>`\ (\ bus_idx\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_send<class_AudioServer_method_set_bus_send>`\ (\ bus_idx\: :ref:`int<class_int>`, send\: :ref:`StringName<class_StringName>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_bus_solo<class_AudioServer_method_set_bus_solo>`\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |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>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_enable_tagging_used_audio_streams<class_AudioServer_method_set_enable_tagging_used_audio_streams>`\ (\ enable\: :ref:`bool<class_bool>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |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>`\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`unlock<class_AudioServer_method_unlock>`\ (\ ) |
+-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_AudioServer_signal_bus_layout_changed:
.. rst-class:: classref-signal
**bus_layout_changed**\ (\ )
Emitted when an audio bus is added, deleted, or moved.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_signal_bus_renamed:
.. rst-class:: classref-signal
**bus_renamed**\ (\ bus_index\: :ref:`int<class_int>`, old_name\: :ref:`StringName<class_StringName>`, new_name\: :ref:`StringName<class_StringName>`\ )
Emitted when the audio bus at ``bus_index`` is renamed from ``old_name`` to ``new_name``.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_AudioServer_SpeakerMode:
.. rst-class:: classref-enumeration
enum **SpeakerMode**:
.. _class_AudioServer_constant_SPEAKER_MODE_STEREO:
.. rst-class:: classref-enumeration-constant
:ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_MODE_STEREO** = ``0``
Two or fewer speakers were detected.
.. _class_AudioServer_constant_SPEAKER_SURROUND_31:
.. rst-class:: classref-enumeration-constant
:ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_SURROUND_31** = ``1``
A 3.1 channel surround setup was detected.
.. _class_AudioServer_constant_SPEAKER_SURROUND_51:
.. rst-class:: classref-enumeration-constant
:ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_SURROUND_51** = ``2``
A 5.1 channel surround setup was detected.
.. _class_AudioServer_constant_SPEAKER_SURROUND_71:
.. rst-class:: classref-enumeration-constant
:ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **SPEAKER_SURROUND_71** = ``3``
A 7.1 channel surround setup was detected.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_AudioServer_property_bus_count:
.. rst-class:: classref-property
:ref:`int<class_int>` **bus_count** = ``1``
.. rst-class:: classref-property-setget
- |void| **set_bus_count**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_bus_count**\ (\ )
Number of available audio buses.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_property_input_device:
.. rst-class:: classref-property
:ref:`String<class_String>` **input_device** = ``"Default"``
.. rst-class:: classref-property-setget
- |void| **set_input_device**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **get_input_device**\ (\ )
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"``.
\ **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.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_property_output_device:
.. rst-class:: classref-property
:ref:`String<class_String>` **output_device** = ``"Default"``
.. rst-class:: classref-property-setget
- |void| **set_output_device**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **get_output_device**\ (\ )
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"``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_property_playback_speed_scale:
.. rst-class:: classref-property
:ref:`float<class_float>` **playback_speed_scale** = ``1.0``
.. rst-class:: classref-property-setget
- |void| **set_playback_speed_scale**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_playback_speed_scale**\ (\ )
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>`.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_AudioServer_method_add_bus:
.. rst-class:: classref-method
|void| **add_bus**\ (\ at_position\: :ref:`int<class_int>` = -1\ )
Adds a bus at ``at_position``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_add_bus_effect:
.. rst-class:: classref-method
|void| **add_bus_effect**\ (\ bus_idx\: :ref:`int<class_int>`, effect\: :ref:`AudioEffect<class_AudioEffect>`, at_position\: :ref:`int<class_int>` = -1\ )
Adds an :ref:`AudioEffect<class_AudioEffect>` effect to the bus ``bus_idx`` at ``at_position``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_generate_bus_layout:
.. rst-class:: classref-method
:ref:`AudioBusLayout<class_AudioBusLayout>` **generate_bus_layout**\ (\ ) |const|
Generates an :ref:`AudioBusLayout<class_AudioBusLayout>` using the available buses and effects.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_channels:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_bus_channels**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
Returns the number of channels of the bus at index ``bus_idx``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_effect:
.. rst-class:: classref-method
:ref:`AudioEffect<class_AudioEffect>` **get_bus_effect**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ )
Returns the :ref:`AudioEffect<class_AudioEffect>` at position ``effect_idx`` in bus ``bus_idx``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_effect_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_bus_effect_count**\ (\ bus_idx\: :ref:`int<class_int>`\ )
Returns the number of effects on the bus at ``bus_idx``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_effect_instance:
.. rst-class:: classref-method
: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\ )
Returns the :ref:`AudioEffectInstance<class_AudioEffectInstance>` assigned to the given bus and effect indices (and optionally channel).
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_index:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_bus_index**\ (\ bus_name\: :ref:`StringName<class_StringName>`\ ) |const|
Returns the index of the bus with the name ``bus_name``. Returns ``-1`` if no bus with the specified name exist.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_name:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_bus_name**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
Returns the name of the bus with the index ``bus_idx``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_peak_volume_left_db:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_bus_peak_volume_left_db**\ (\ bus_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>`\ ) |const|
Returns the peak volume of the left speaker at bus index ``bus_idx`` and channel index ``channel``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_peak_volume_right_db:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_bus_peak_volume_right_db**\ (\ bus_idx\: :ref:`int<class_int>`, channel\: :ref:`int<class_int>`\ ) |const|
Returns the peak volume of the right speaker at bus index ``bus_idx`` and channel index ``channel``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_send:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **get_bus_send**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
Returns the name of the bus that the bus at index ``bus_idx`` sends to.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_bus_volume_db:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_bus_volume_db**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
Returns the volume of the bus at index ``bus_idx`` in dB.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_input_device_list:
.. rst-class:: classref-method
:ref:`PackedStringArray<class_PackedStringArray>` **get_input_device_list**\ (\ )
Returns the names of all audio input devices detected on the system.
\ **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.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_mix_rate:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_mix_rate**\ (\ ) |const|
Returns the sample rate at the output of the **AudioServer**.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_output_device_list:
.. rst-class:: classref-method
:ref:`PackedStringArray<class_PackedStringArray>` **get_output_device_list**\ (\ )
Returns the names of all audio output devices detected on the system.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_output_latency:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_output_latency**\ (\ ) |const|
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.
\ **Note:** This can be expensive; it is not recommended to call :ref:`get_output_latency<class_AudioServer_method_get_output_latency>` every frame.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_speaker_mode:
.. rst-class:: classref-method
:ref:`SpeakerMode<enum_AudioServer_SpeakerMode>` **get_speaker_mode**\ (\ ) |const|
Returns the speaker configuration.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_time_since_last_mix:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_time_since_last_mix**\ (\ ) |const|
Returns the relative time since the last mix occurred.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_get_time_to_next_mix:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_time_to_next_mix**\ (\ ) |const|
Returns the relative time until the next mix occurs.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_is_bus_bypassing_effects:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_bus_bypassing_effects**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
If ``true``, the bus at index ``bus_idx`` is bypassing effects.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_is_bus_effect_enabled:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_bus_effect_enabled**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ ) |const|
If ``true``, the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_is_bus_mute:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_bus_mute**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
If ``true``, the bus at index ``bus_idx`` is muted.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_is_bus_solo:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_bus_solo**\ (\ bus_idx\: :ref:`int<class_int>`\ ) |const|
If ``true``, the bus at index ``bus_idx`` is in solo mode.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_lock:
.. rst-class:: classref-method
|void| **lock**\ (\ )
Locks the audio driver's main loop.
\ **Note:** Remember to unlock it afterwards.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_move_bus:
.. rst-class:: classref-method
|void| **move_bus**\ (\ index\: :ref:`int<class_int>`, to_index\: :ref:`int<class_int>`\ )
Moves the bus from index ``index`` to index ``to_index``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_remove_bus:
.. rst-class:: classref-method
|void| **remove_bus**\ (\ index\: :ref:`int<class_int>`\ )
Removes the bus at index ``index``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_remove_bus_effect:
.. rst-class:: classref-method
|void| **remove_bus_effect**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`\ )
Removes the effect at index ``effect_idx`` from the bus at index ``bus_idx``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_bypass_effects:
.. rst-class:: classref-method
|void| **set_bus_bypass_effects**\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ )
If ``true``, the bus at index ``bus_idx`` is bypassing effects.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_effect_enabled:
.. rst-class:: classref-method
|void| **set_bus_effect_enabled**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ )
If ``true``, the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_layout:
.. rst-class:: classref-method
|void| **set_bus_layout**\ (\ bus_layout\: :ref:`AudioBusLayout<class_AudioBusLayout>`\ )
Overwrites the currently used :ref:`AudioBusLayout<class_AudioBusLayout>`.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_mute:
.. rst-class:: classref-method
|void| **set_bus_mute**\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ )
If ``true``, the bus at index ``bus_idx`` is muted.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_name:
.. rst-class:: classref-method
|void| **set_bus_name**\ (\ bus_idx\: :ref:`int<class_int>`, name\: :ref:`String<class_String>`\ )
Sets the name of the bus at index ``bus_idx`` to ``name``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_send:
.. rst-class:: classref-method
|void| **set_bus_send**\ (\ bus_idx\: :ref:`int<class_int>`, send\: :ref:`StringName<class_StringName>`\ )
Connects the output of the bus at ``bus_idx`` to the bus named ``send``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_solo:
.. rst-class:: classref-method
|void| **set_bus_solo**\ (\ bus_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ )
If ``true``, the bus at index ``bus_idx`` is in solo mode.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_bus_volume_db:
.. rst-class:: classref-method
|void| **set_bus_volume_db**\ (\ bus_idx\: :ref:`int<class_int>`, volume_db\: :ref:`float<class_float>`\ )
Sets the volume of the bus at index ``bus_idx`` to ``volume_db``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_set_enable_tagging_used_audio_streams:
.. rst-class:: classref-method
|void| **set_enable_tagging_used_audio_streams**\ (\ enable\: :ref:`bool<class_bool>`\ )
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.
\ **Note:** This is enabled by default in the editor, as it is used by editor plugins for the audio stream previews.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_swap_bus_effects:
.. rst-class:: classref-method
|void| **swap_bus_effects**\ (\ bus_idx\: :ref:`int<class_int>`, effect_idx\: :ref:`int<class_int>`, by_effect_idx\: :ref:`int<class_int>`\ )
Swaps the position of two effects in bus ``bus_idx``.
.. rst-class:: classref-item-separator
----
.. _class_AudioServer_method_unlock:
.. rst-class:: classref-method
|void| **unlock**\ (\ )
Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`