:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the AudioServer.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_AudioServer: AudioServer =========== **Inherits:** :ref:`Object` **Category:** Core Brief Description ----------------- Server interface for low level audio access. Methods ------- +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_bus` **(** :ref:`int` at_position=-1 **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_bus_effect` **(** :ref:`int` bus_idx, :ref:`AudioEffect` effect, :ref:`int` at_position=-1 **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`capture_get_device` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`capture_get_device_list` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`capture_set_device` **(** :ref:`String` name **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AudioBusLayout` | :ref:`generate_bus_layout` **(** **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bus_channels` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bus_count` **(** **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AudioEffect` | :ref:`get_bus_effect` **(** :ref:`int` bus_idx, :ref:`int` effect_idx **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bus_effect_count` **(** :ref:`int` bus_idx **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AudioEffectInstance` | :ref:`get_bus_effect_instance` **(** :ref:`int` bus_idx, :ref:`int` effect_idx, :ref:`int` channel=0 **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bus_index` **(** :ref:`String` bus_name **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_bus_name` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_bus_peak_volume_left_db` **(** :ref:`int` bus_idx, :ref:`int` channel **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_bus_peak_volume_right_db` **(** :ref:`int` bus_idx, :ref:`int` channel **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_bus_send` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_bus_volume_db` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_device` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_device_list` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_mix_rate` **(** **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`SpeakerMode` | :ref:`get_speaker_mode` **(** **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_bus_bypassing_effects` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_bus_effect_enabled` **(** :ref:`int` bus_idx, :ref:`int` effect_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_bus_mute` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_bus_solo` **(** :ref:`int` bus_idx **)** const | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`lock` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`move_bus` **(** :ref:`int` index, :ref:`int` to_index **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_bus` **(** :ref:`int` index **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_bus_effect` **(** :ref:`int` bus_idx, :ref:`int` effect_idx **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_bypass_effects` **(** :ref:`int` bus_idx, :ref:`bool` enable **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_count` **(** :ref:`int` amount **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_effect_enabled` **(** :ref:`int` bus_idx, :ref:`int` effect_idx, :ref:`bool` enabled **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_layout` **(** :ref:`AudioBusLayout` bus_layout **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_mute` **(** :ref:`int` bus_idx, :ref:`bool` enable **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_name` **(** :ref:`int` bus_idx, :ref:`String` name **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_send` **(** :ref:`int` bus_idx, :ref:`String` send **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_solo` **(** :ref:`int` bus_idx, :ref:`bool` enable **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bus_volume_db` **(** :ref:`int` bus_idx, :ref:`float` volume_db **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_device` **(** :ref:`String` device **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`swap_bus_effects` **(** :ref:`int` bus_idx, :ref:`int` effect_idx, :ref:`int` by_effect_idx **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`unlock` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_AudioServer_signal_bus_layout_changed: - **bus_layout_changed** **(** **)** Emitted when the :ref:`AudioBusLayout` changes. Enumerations ------------ .. _enum_AudioServer_SpeakerMode: .. _class_AudioServer_constant_SPEAKER_MODE_STEREO: .. _class_AudioServer_constant_SPEAKER_SURROUND_31: .. _class_AudioServer_constant_SPEAKER_SURROUND_51: .. _class_AudioServer_constant_SPEAKER_SURROUND_71: enum **SpeakerMode**: - **SPEAKER_MODE_STEREO** = **0** --- Two or fewer speakers are detected. - **SPEAKER_SURROUND_31** = **1** - **SPEAKER_SURROUND_51** = **2** --- A 5.1 channel surround setup detected. - **SPEAKER_SURROUND_71** = **3** --- A 7.1 channel surround setup detected. 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. Tutorials --------- - :doc:`../tutorials/audio/audio_buses` Method Descriptions ------------------- .. _class_AudioServer_method_add_bus: - void **add_bus** **(** :ref:`int` at_position=-1 **)** Adds a bus at ``at_position``. ---- .. _class_AudioServer_method_add_bus_effect: - void **add_bus_effect** **(** :ref:`int` bus_idx, :ref:`AudioEffect` effect, :ref:`int` at_position=-1 **)** Adds an :ref:`AudioEffect` effect to the bus ``bus_idx`` at ``at_position``. ---- .. _class_AudioServer_method_capture_get_device: - :ref:`String` **capture_get_device** **(** **)** ---- .. _class_AudioServer_method_capture_get_device_list: - :ref:`Array` **capture_get_device_list** **(** **)** ---- .. _class_AudioServer_method_capture_set_device: - void **capture_set_device** **(** :ref:`String` name **)** ---- .. _class_AudioServer_method_generate_bus_layout: - :ref:`AudioBusLayout` **generate_bus_layout** **(** **)** const Generates an :ref:`AudioBusLayout` using the available buses and effects. ---- .. _class_AudioServer_method_get_bus_channels: - :ref:`int` **get_bus_channels** **(** :ref:`int` bus_idx **)** const Returns the amount of channels of the bus at index ``bus_idx``. ---- .. _class_AudioServer_method_get_bus_count: - :ref:`int` **get_bus_count** **(** **)** const Returns the number of available buses. ---- .. _class_AudioServer_method_get_bus_effect: - :ref:`AudioEffect` **get_bus_effect** **(** :ref:`int` bus_idx, :ref:`int` effect_idx **)** Returns the :ref:`AudioEffect` at position ``effect_idx`` in bus ``bus_idx``. ---- .. _class_AudioServer_method_get_bus_effect_count: - :ref:`int` **get_bus_effect_count** **(** :ref:`int` bus_idx **)** Returns the number of effects on the bus at ``bus_idx``. ---- .. _class_AudioServer_method_get_bus_effect_instance: - :ref:`AudioEffectInstance` **get_bus_effect_instance** **(** :ref:`int` bus_idx, :ref:`int` effect_idx, :ref:`int` channel=0 **)** ---- .. _class_AudioServer_method_get_bus_index: - :ref:`int` **get_bus_index** **(** :ref:`String` bus_name **)** const Returns the index of the bus with the name ``bus_name``. ---- .. _class_AudioServer_method_get_bus_name: - :ref:`String` **get_bus_name** **(** :ref:`int` bus_idx **)** const Returns the name of the bus with the index ``bus_idx``. ---- .. _class_AudioServer_method_get_bus_peak_volume_left_db: - :ref:`float` **get_bus_peak_volume_left_db** **(** :ref:`int` bus_idx, :ref:`int` channel **)** const Returns the peak volume of the left speaker at bus index ``bus_idx`` and channel index ``channel``. ---- .. _class_AudioServer_method_get_bus_peak_volume_right_db: - :ref:`float` **get_bus_peak_volume_right_db** **(** :ref:`int` bus_idx, :ref:`int` channel **)** const Returns the peak volume of the right speaker at bus index ``bus_idx`` and channel index ``channel``. ---- .. _class_AudioServer_method_get_bus_send: - :ref:`String` **get_bus_send** **(** :ref:`int` bus_idx **)** const Returns the name of the bus that the bus at index ``bus_idx`` sends to. ---- .. _class_AudioServer_method_get_bus_volume_db: - :ref:`float` **get_bus_volume_db** **(** :ref:`int` bus_idx **)** const Returns the volume of the bus at index ``bus_idx`` in dB. ---- .. _class_AudioServer_method_get_device: - :ref:`String` **get_device** **(** **)** ---- .. _class_AudioServer_method_get_device_list: - :ref:`Array` **get_device_list** **(** **)** ---- .. _class_AudioServer_method_get_mix_rate: - :ref:`float` **get_mix_rate** **(** **)** const Returns the sample rate at the output of the audioserver. ---- .. _class_AudioServer_method_get_speaker_mode: - :ref:`SpeakerMode` **get_speaker_mode** **(** **)** const Returns the speaker configuration. ---- .. _class_AudioServer_method_is_bus_bypassing_effects: - :ref:`bool` **is_bus_bypassing_effects** **(** :ref:`int` bus_idx **)** const If ``true``, the bus at index ``bus_idx`` is bypassing effects. ---- .. _class_AudioServer_method_is_bus_effect_enabled: - :ref:`bool` **is_bus_effect_enabled** **(** :ref:`int` bus_idx, :ref:`int` effect_idx **)** const If ``true``, the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled. ---- .. _class_AudioServer_method_is_bus_mute: - :ref:`bool` **is_bus_mute** **(** :ref:`int` bus_idx **)** const If ``true``, the bus at index ``bus_idx`` is muted. ---- .. _class_AudioServer_method_is_bus_solo: - :ref:`bool` **is_bus_solo** **(** :ref:`int` bus_idx **)** const If ``true``, the bus at index ``bus_idx`` is in solo mode. ---- .. _class_AudioServer_method_lock: - void **lock** **(** **)** Locks the audio drivers mainloop. Remember to unlock it afterwards. ---- .. _class_AudioServer_method_move_bus: - void **move_bus** **(** :ref:`int` index, :ref:`int` to_index **)** Moves the bus from index ``index`` to index ``to_index``. ---- .. _class_AudioServer_method_remove_bus: - void **remove_bus** **(** :ref:`int` index **)** Removes the bus at index ``index``. ---- .. _class_AudioServer_method_remove_bus_effect: - void **remove_bus_effect** **(** :ref:`int` bus_idx, :ref:`int` effect_idx **)** Removes the effect at index ``effect_idx`` from the bus at index ``bus_idx``. ---- .. _class_AudioServer_method_set_bus_bypass_effects: - void **set_bus_bypass_effects** **(** :ref:`int` bus_idx, :ref:`bool` enable **)** If ``true``, the bus at index ``bus_idx`` is bypassing effects. ---- .. _class_AudioServer_method_set_bus_count: - void **set_bus_count** **(** :ref:`int` amount **)** Adds and removes buses to make the number of buses match ``amount``. ---- .. _class_AudioServer_method_set_bus_effect_enabled: - void **set_bus_effect_enabled** **(** :ref:`int` bus_idx, :ref:`int` effect_idx, :ref:`bool` enabled **)** If ``true``, the effect at index ``effect_idx`` on the bus at index ``bus_idx`` is enabled. ---- .. _class_AudioServer_method_set_bus_layout: - void **set_bus_layout** **(** :ref:`AudioBusLayout` bus_layout **)** Overwrites the currently used :ref:`AudioBusLayout`. ---- .. _class_AudioServer_method_set_bus_mute: - void **set_bus_mute** **(** :ref:`int` bus_idx, :ref:`bool` enable **)** If ``true``, the bus at index ``bus_idx`` is muted. ---- .. _class_AudioServer_method_set_bus_name: - void **set_bus_name** **(** :ref:`int` bus_idx, :ref:`String` name **)** Sets the name of the bus at index ``bus_idx`` to ``name``. ---- .. _class_AudioServer_method_set_bus_send: - void **set_bus_send** **(** :ref:`int` bus_idx, :ref:`String` send **)** Connects the output of the bus at ``bus_idx`` to the bus named ``send``. ---- .. _class_AudioServer_method_set_bus_solo: - void **set_bus_solo** **(** :ref:`int` bus_idx, :ref:`bool` enable **)** If ``true``, the bus at index ``bus_idx`` is in solo mode. ---- .. _class_AudioServer_method_set_bus_volume_db: - void **set_bus_volume_db** **(** :ref:`int` bus_idx, :ref:`float` volume_db **)** Sets the volume of the bus at index ``bus_idx`` to ``volume_db``. ---- .. _class_AudioServer_method_set_device: - void **set_device** **(** :ref:`String` device **)** ---- .. _class_AudioServer_method_swap_bus_effects: - void **swap_bus_effects** **(** :ref:`int` bus_idx, :ref:`int` effect_idx, :ref:`int` by_effect_idx **)** Swaps the position of two effects in bus ``bus_idx``. ---- .. _class_AudioServer_method_unlock: - void **unlock** **(** **)** Unlocks the audiodriver's main loop. After locking it always unlock it.