2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 08:08:05 +00:00
<class name= "AudioServer" inherits= "Object" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
2019-06-21 23:04:47 +00:00
Server interface for low-level audio access.
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2020-01-23 10:14:14 +00:00
[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.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2021-11-15 09:43:07 +00:00
<link title= "Audio buses" > $DOCS_URL/tutorials/audio/audio_buses.html</link>
2024-03-25 01:20:59 +00:00
<link title= "Audio Device Changer Demo" > https://godotengine.org/asset-library/asset/2758</link>
<link title= "Audio Microphone Record Demo" > https://godotengine.org/asset-library/asset/2760</link>
<link title= "Audio Spectrum Visualizer Demo" > https://godotengine.org/asset-library/asset/2762</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
<method name= "add_bus" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "at_position" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Adds a bus at [param at_position].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "add_bus_effect" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect" type= "AudioEffect" />
<param index= "2" name= "at_position" type= "int" default= "-1" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Adds an [AudioEffect] effect to the bus [param bus_idx] at [param at_position].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "generate_bus_layout" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "AudioBusLayout" />
2017-09-12 20:42:36 +00:00
<description >
2019-02-13 08:23:29 +00:00
Generates an [AudioBusLayout] using the available buses and effects.
2017-09-12 20:42:36 +00:00
</description>
</method>
2018-12-07 16:38:40 +00:00
<method name= "get_bus_channels" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2018-12-07 16:38:40 +00:00
<description >
2022-08-17 22:08:09 +00:00
Returns the number of channels of the bus at index [param bus_idx].
2018-12-07 16:38:40 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_bus_effect" >
2021-07-30 13:28:05 +00:00
<return type= "AudioEffect" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the [AudioEffect] at position [param effect_idx] in bus [param bus_idx].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_bus_effect_count" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the number of effects on the bus at [param bus_idx].
2017-09-12 20:42:36 +00:00
</description>
</method>
2019-04-15 12:49:41 +00:00
<method name= "get_bus_effect_instance" >
2021-07-30 13:28:05 +00:00
<return type= "AudioEffectInstance" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect_idx" type= "int" />
<param index= "2" name= "channel" type= "int" default= "0" />
2019-04-15 12:49:41 +00:00
<description >
2020-01-23 10:14:14 +00:00
Returns the [AudioEffectInstance] assigned to the given bus and effect indices (and optionally channel).
2019-04-15 12:49:41 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_bus_index" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_name" type= "StringName" />
2017-09-12 20:42:36 +00:00
<description >
2023-06-12 14:56:31 +00:00
Returns the index of the bus with the name [param bus_name]. Returns [code]-1[/code] if no bus with the specified name exist.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_bus_name" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the name of the bus with the index [param bus_idx].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_bus_peak_volume_left_db" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "channel" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the peak volume of the left speaker at bus index [param bus_idx] and channel index [param channel].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_bus_peak_volume_right_db" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "channel" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the peak volume of the right speaker at bus index [param bus_idx] and channel index [param channel].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_bus_send" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "StringName" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the name of the bus that the bus at index [param bus_idx] sends to.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_bus_volume_db" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Returns the volume of the bus at index [param bus_idx] in dB.
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-11-24 14:41:40 +00:00
<method name= "get_input_device_list" >
2022-08-05 01:41:48 +00:00
<return type= "PackedStringArray" />
2018-04-10 08:12:42 +00:00
<description >
2022-11-24 14:41:40 +00:00
Returns the names of all audio input devices detected on the system.
[b]Note:[/b] [member ProjectSettings.audio/driver/enable_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
2019-06-02 23:01:42 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_mix_rate" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2017-09-12 20:42:36 +00:00
<description >
2019-07-02 10:04:26 +00:00
Returns the sample rate at the output of the [AudioServer].
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-11-24 14:41:40 +00:00
<method name= "get_output_device_list" >
<return type= "PackedStringArray" />
<description >
Returns the names of all audio output devices detected on the system.
</description>
</method>
2019-04-27 17:11:39 +00:00
<method name= "get_output_latency" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2019-04-27 17:11:39 +00:00
<description >
2023-06-08 17:46:05 +00:00
Returns the audio driver's effective output latency. This is based on [member ProjectSettings.audio/driver/output_latency], but the exact returned value will differ depending on the operating system and audio driver.
[b]Note:[/b] This can be expensive; it is not recommended to call [method get_output_latency] every frame.
2019-04-27 17:11:39 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "get_speaker_mode" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "AudioServer.SpeakerMode" />
2017-09-12 20:42:36 +00:00
<description >
2017-10-10 14:00:10 +00:00
Returns the speaker configuration.
2017-09-12 20:42:36 +00:00
</description>
</method>
2019-04-27 17:11:39 +00:00
<method name= "get_time_since_last_mix" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2019-04-27 17:11:39 +00:00
<description >
2020-01-23 10:14:14 +00:00
Returns the relative time since the last mix occurred.
2019-04-27 17:11:39 +00:00
</description>
</method>
<method name= "get_time_to_next_mix" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "float" />
2019-04-27 17:11:39 +00:00
<description >
2020-01-23 10:14:14 +00:00
Returns the relative time until the next mix occurs.
2019-04-27 17:11:39 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "is_bus_bypassing_effects" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the bus at index [param bus_idx] is bypassing effects.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "is_bus_effect_enabled" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the effect at index [param effect_idx] on the bus at index [param bus_idx] is enabled.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "is_bus_mute" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the bus at index [param bus_idx] is muted.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "is_bus_solo" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the bus at index [param bus_idx] is in solo mode.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "lock" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
2020-01-23 10:14:14 +00:00
Locks the audio driver's main loop.
[b]Note:[/b] Remember to unlock it afterwards.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "move_bus" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "index" type= "int" />
<param index= "1" name= "to_index" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Moves the bus from index [param index] to index [param to_index].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "remove_bus" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "index" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Removes the bus at index [param index].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "remove_bus_effect" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Removes the effect at index [param effect_idx] from the bus at index [param bus_idx].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_bypass_effects" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "enable" type= "bool" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the bus at index [param bus_idx] is bypassing effects.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_effect_enabled" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect_idx" type= "int" />
<param index= "2" name= "enabled" type= "bool" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the effect at index [param effect_idx] on the bus at index [param bus_idx] is enabled.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_layout" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_layout" type= "AudioBusLayout" />
2017-09-12 20:42:36 +00:00
<description >
2017-10-10 14:00:10 +00:00
Overwrites the currently used [AudioBusLayout].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_mute" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "enable" type= "bool" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the bus at index [param bus_idx] is muted.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_name" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "name" type= "String" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Sets the name of the bus at index [param bus_idx] to [param name].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_send" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "send" type= "StringName" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Connects the output of the bus at [param bus_idx] to the bus named [param send].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_solo" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "enable" type= "bool" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
If [code]true[/code], the bus at index [param bus_idx] is in solo mode.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "set_bus_volume_db" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "volume_db" type= "float" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Sets the volume of the bus at index [param bus_idx] to [param volume_db].
2017-09-12 20:42:36 +00:00
</description>
</method>
2022-07-20 23:00:58 +00:00
<method name= "set_enable_tagging_used_audio_streams" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "enable" type= "bool" />
2022-07-20 23:00:58 +00:00
<description >
2024-01-07 16:28:48 +00:00
If set to [code]true[/code], all instances of [AudioStreamPlayback] will call [method AudioStreamPlayback._tag_used_streams] every mix step.
[b]Note:[/b] This is enabled by default in the editor, as it is used by editor plugins for the audio stream previews.
2022-07-20 23:00:58 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<method name= "swap_bus_effects" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bus_idx" type= "int" />
<param index= "1" name= "effect_idx" type= "int" />
<param index= "2" name= "by_effect_idx" type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2022-08-12 17:51:01 +00:00
Swaps the position of two effects in bus [param bus_idx].
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "unlock" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-21 23:04:47 +00:00
Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)
2017-09-12 20:42:36 +00:00
</description>
</method>
</methods>
2019-06-02 23:01:42 +00:00
<members >
2019-07-02 10:04:26 +00:00
<member name= "bus_count" type= "int" setter= "set_bus_count" getter= "get_bus_count" default= "1" >
Number of available audio buses.
2019-06-02 23:01:42 +00:00
</member>
2022-11-24 14:41:40 +00:00
<member name= "input_device" type= "String" setter= "set_input_device" getter= "get_input_device" default= ""Default"" >
Name of the current device for audio input (see [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 [code]"Default"[/code] will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code].
2022-09-02 17:17:00 +00:00
[b]Note:[/b] [member ProjectSettings.audio/driver/enable_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
2022-02-14 17:09:09 +00:00
</member>
2022-11-24 14:41:40 +00:00
<member name= "output_device" type= "String" setter= "set_output_device" getter= "get_output_device" default= ""Default"" >
Name of the current device for audio output (see [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 [code]"Default"[/code] will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code].
2019-07-09 17:11:11 +00:00
</member>
2020-05-07 16:46:33 +00:00
<member name= "playback_speed_scale" type= "float" setter= "set_playback_speed_scale" getter= "get_playback_speed_scale" default= "1.0" >
2023-12-12 12:10:16 +00:00
Scales the rate at which audio is played (i.e. setting it to [code]0.5[/code] will make the audio be played at half its speed). See also [member Engine.time_scale] to affect the general simulation speed, which is independent from [member AudioServer.playback_speed_scale].
2019-06-02 23:01:42 +00:00
</member>
</members>
2017-09-12 20:42:36 +00:00
<signals >
<signal name= "bus_layout_changed" >
<description >
2023-09-14 10:39:23 +00:00
Emitted when an audio bus is added, deleted, or moved.
</description>
</signal>
<signal name= "bus_renamed" >
<param index= "0" name= "bus_index" type= "int" />
<param index= "1" name= "old_name" type= "StringName" />
<param index= "2" name= "new_name" type= "StringName" />
<description >
Emitted when the audio bus at [param bus_index] is renamed from [param old_name] to [param new_name].
2017-09-12 20:42:36 +00:00
</description>
</signal>
</signals>
<constants >
2017-11-24 22:16:30 +00:00
<constant name= "SPEAKER_MODE_STEREO" value= "0" enum= "SpeakerMode" >
2019-07-02 10:04:26 +00:00
Two or fewer speakers were detected.
2017-09-15 23:46:14 +00:00
</constant>
2018-10-25 13:14:36 +00:00
<constant name= "SPEAKER_SURROUND_31" value= "1" enum= "SpeakerMode" >
2019-07-02 10:04:26 +00:00
A 3.1 channel surround setup was detected.
2018-10-25 13:14:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "SPEAKER_SURROUND_51" value= "2" enum= "SpeakerMode" >
2020-01-23 10:14:14 +00:00
A 5.1 channel surround setup was detected.
2017-09-15 23:46:14 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "SPEAKER_SURROUND_71" value= "3" enum= "SpeakerMode" >
2020-01-23 10:14:14 +00:00
A 7.1 channel surround setup was detected.
2017-09-15 23:46:14 +00:00
</constant>
2017-09-12 20:42:36 +00:00
</constants>
</class>