2022-03-15 13:29:32 +01:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-08-26 22:41:21 +02:00
<class name= "AudioServer" inherits= "Object" version= "4.1" >
2022-03-15 13:29:32 +01:00
<brief_description >
Server interface for low-level audio access.
</brief_description>
<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.
</description>
<tutorials >
2023-08-29 22:33:15 +02:00
<link title= "Audio buses" > $DOCS_URL/tutorials/audio/audio_buses.md</link>
2022-03-15 13:29:32 +01:00
<link title= "Audio Device Changer Demo" > https://godotengine.org/asset-library/asset/525</link>
<link title= "Audio Mic Record Demo" > https://godotengine.org/asset-library/asset/527</link>
<link title= "Audio Spectrum Demo" > https://godotengine.org/asset-library/asset/528</link>
</tutorials>
<methods >
<method name= "add_bus" >
<return type= "void" />
<argument index= "0" name= "at_position" type= "int" default= "-1" />
<description >
Adds a bus at [code]at_position[/code].
</description>
</method>
<method name= "add_bus_effect" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect" type= "AudioEffect" />
<argument index= "2" name= "at_position" type= "int" default= "-1" />
<description >
Adds an [AudioEffect] effect to the bus [code]bus_idx[/code] at [code]at_position[/code].
</description>
</method>
<method name= "capture_get_device_list" >
<return type= "Array" />
<description >
Returns the names of all audio input devices detected on the system.
2022-09-02 19:17:00 +02:00
[b]Note:[/b] [member ProjectSettings.audio/enable_audio_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-03-15 13:29:32 +01:00
</description>
</method>
<method name= "generate_bus_layout" qualifiers= "const" >
<return type= "AudioBusLayout" />
<description >
Generates an [AudioBusLayout] using the available buses and effects.
</description>
</method>
<method name= "get_bus_channels" qualifiers= "const" >
<return type= "int" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
Returns the amount of channels of the bus at index [code]bus_idx[/code].
</description>
</method>
<method name= "get_bus_effect" >
<return type= "AudioEffect" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect_idx" type= "int" />
<description >
Returns the [AudioEffect] at position [code]effect_idx[/code] in bus [code]bus_idx[/code].
</description>
</method>
<method name= "get_bus_effect_count" >
<return type= "int" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
Returns the number of effects on the bus at [code]bus_idx[/code].
</description>
</method>
<method name= "get_bus_effect_instance" >
<return type= "AudioEffectInstance" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect_idx" type= "int" />
<argument index= "2" name= "channel" type= "int" default= "0" />
<description >
Returns the [AudioEffectInstance] assigned to the given bus and effect indices (and optionally channel).
</description>
</method>
<method name= "get_bus_index" qualifiers= "const" >
<return type= "int" />
2022-03-24 01:22:45 +01:00
<argument index= "0" name= "bus_name" type= "StringName" />
2022-03-15 13:29:32 +01:00
<description >
</description>
</method>
<method name= "get_bus_name" qualifiers= "const" >
<return type= "String" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
Returns the name of the bus with the index [code]bus_idx[/code].
</description>
</method>
<method name= "get_bus_peak_volume_left_db" qualifiers= "const" >
<return type= "float" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "channel" type= "int" />
<description >
Returns the peak volume of the left speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
</description>
</method>
<method name= "get_bus_peak_volume_right_db" qualifiers= "const" >
<return type= "float" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "channel" type= "int" />
<description >
Returns the peak volume of the right speaker at bus index [code]bus_idx[/code] and channel index [code]channel[/code].
</description>
</method>
<method name= "get_bus_send" qualifiers= "const" >
2022-03-24 01:22:45 +01:00
<return type= "StringName" />
2022-03-15 13:29:32 +01:00
<argument index= "0" name= "bus_idx" type= "int" />
<description >
Returns the name of the bus that the bus at index [code]bus_idx[/code] sends to.
</description>
</method>
<method name= "get_bus_volume_db" qualifiers= "const" >
<return type= "float" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
Returns the volume of the bus at index [code]bus_idx[/code] in dB.
</description>
</method>
<method name= "get_device_list" >
<return type= "Array" />
<description >
Returns the names of all audio devices detected on the system.
</description>
</method>
<method name= "get_mix_rate" qualifiers= "const" >
<return type= "float" />
<description >
Returns the sample rate at the output of the [AudioServer].
</description>
</method>
<method name= "get_output_latency" qualifiers= "const" >
<return type= "float" />
<description >
2021-01-13 08:20:56 +01:00
Returns the audio driver's output latency. This can be expensive, it is not recommended to call this every frame.
2022-03-15 13:29:32 +01:00
</description>
</method>
<method name= "get_speaker_mode" qualifiers= "const" >
<return type= "int" enum= "AudioServer.SpeakerMode" />
<description >
Returns the speaker configuration.
</description>
</method>
<method name= "get_time_since_last_mix" qualifiers= "const" >
<return type= "float" />
<description >
Returns the relative time since the last mix occurred.
</description>
</method>
<method name= "get_time_to_next_mix" qualifiers= "const" >
<return type= "float" />
<description >
Returns the relative time until the next mix occurs.
</description>
</method>
<method name= "is_bus_bypassing_effects" qualifiers= "const" >
<return type= "bool" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
If [code]true[/code], the bus at index [code]bus_idx[/code] is bypassing effects.
</description>
</method>
<method name= "is_bus_effect_enabled" qualifiers= "const" >
<return type= "bool" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect_idx" type= "int" />
<description >
If [code]true[/code], the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
</description>
</method>
<method name= "is_bus_mute" qualifiers= "const" >
<return type= "bool" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
If [code]true[/code], the bus at index [code]bus_idx[/code] is muted.
</description>
</method>
<method name= "is_bus_solo" qualifiers= "const" >
<return type= "bool" />
<argument index= "0" name= "bus_idx" type= "int" />
<description >
If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
</description>
</method>
2023-04-10 19:42:23 +02:00
<method name= "is_enabled" qualifiers= "const" >
<return type= "bool" />
<description >
If [code]false[/code], the audio server is disabled / muted.
</description>
</method>
2022-03-15 13:29:32 +01:00
<method name= "lock" >
<return type= "void" />
<description >
Locks the audio driver's main loop.
[b]Note:[/b] Remember to unlock it afterwards.
</description>
</method>
<method name= "move_bus" >
<return type= "void" />
<argument index= "0" name= "index" type= "int" />
<argument index= "1" name= "to_index" type= "int" />
<description >
Moves the bus from index [code]index[/code] to index [code]to_index[/code].
</description>
</method>
<method name= "remove_bus" >
<return type= "void" />
<argument index= "0" name= "index" type= "int" />
<description >
Removes the bus at index [code]index[/code].
</description>
</method>
<method name= "remove_bus_effect" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect_idx" type= "int" />
<description >
Removes the effect at index [code]effect_idx[/code] from the bus at index [code]bus_idx[/code].
</description>
</method>
<method name= "set_bus_bypass_effects" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "enable" type= "bool" />
<description >
If [code]true[/code], the bus at index [code]bus_idx[/code] is bypassing effects.
</description>
</method>
<method name= "set_bus_effect_enabled" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect_idx" type= "int" />
<argument index= "2" name= "enabled" type= "bool" />
<description >
If [code]true[/code], the effect at index [code]effect_idx[/code] on the bus at index [code]bus_idx[/code] is enabled.
</description>
</method>
<method name= "set_bus_layout" >
<return type= "void" />
<argument index= "0" name= "bus_layout" type= "AudioBusLayout" />
<description >
Overwrites the currently used [AudioBusLayout].
</description>
</method>
<method name= "set_bus_mute" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "enable" type= "bool" />
<description >
If [code]true[/code], the bus at index [code]bus_idx[/code] is muted.
</description>
</method>
<method name= "set_bus_name" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "name" type= "String" />
<description >
Sets the name of the bus at index [code]bus_idx[/code] to [code]name[/code].
</description>
</method>
<method name= "set_bus_send" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
2022-03-24 01:22:45 +01:00
<argument index= "1" name= "send" type= "StringName" />
2022-03-15 13:29:32 +01:00
<description >
</description>
</method>
<method name= "set_bus_solo" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "enable" type= "bool" />
<description >
If [code]true[/code], the bus at index [code]bus_idx[/code] is in solo mode.
</description>
</method>
<method name= "set_bus_volume_db" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "volume_db" type= "float" />
<description >
Sets the volume of the bus at index [code]bus_idx[/code] to [code]volume_db[/code].
</description>
</method>
2023-04-10 19:42:23 +02:00
<method name= "set_enabled" >
<return type= "void" />
<argument index= "0" name= "enabled" type= "bool" />
<description >
Allows disabling / muting the audio server. As well as muting, this will minimize audio CPU usage.
</description>
</method>
2022-03-15 13:29:32 +01:00
<method name= "swap_bus_effects" >
<return type= "void" />
<argument index= "0" name= "bus_idx" type= "int" />
<argument index= "1" name= "effect_idx" type= "int" />
<argument index= "2" name= "by_effect_idx" type= "int" />
<description >
Swaps the position of two effects in bus [code]bus_idx[/code].
</description>
</method>
<method name= "unlock" >
<return type= "void" />
<description >
Unlocks the audio driver's main loop. (After locking it, you should always unlock it.)
</description>
</method>
</methods>
<members >
<member name= "bus_count" type= "int" setter= "set_bus_count" getter= "get_bus_count" default= "1" >
Number of available audio buses.
</member>
<member name= "capture_device" type= "String" setter= "capture_set_device" getter= "capture_get_device" default= ""Default"" >
2022-09-02 19:17:00 +02:00
Name of the current device for audio input (see [method capture_get_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].
[b]Note:[/b] [member ProjectSettings.audio/enable_audio_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-03-15 13:29:32 +01:00
</member>
<member name= "device" type= "String" setter= "set_device" getter= "get_device" default= ""Default"" >
Name of the current device for audio output (see [method get_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].
</member>
<member name= "global_rate_scale" type= "float" setter= "set_global_rate_scale" getter= "get_global_rate_scale" default= "1.0" >
Scales the rate at which audio is played (i.e. setting it to [code]0.5[/code] will make the audio be played twice as fast).
</member>
</members>
<signals >
<signal name= "bus_layout_changed" >
<description >
Emitted when the [AudioBusLayout] changes.
</description>
</signal>
</signals>
<constants >
<constant name= "SPEAKER_MODE_STEREO" value= "0" enum= "SpeakerMode" >
Two or fewer speakers were detected.
</constant>
<constant name= "SPEAKER_SURROUND_31" value= "1" enum= "SpeakerMode" >
A 3.1 channel surround setup was detected.
</constant>
<constant name= "SPEAKER_SURROUND_51" value= "2" enum= "SpeakerMode" >
A 5.1 channel surround setup was detected.
</constant>
<constant name= "SPEAKER_SURROUND_71" value= "3" enum= "SpeakerMode" >
A 7.1 channel surround setup was detected.
</constant>
</constants>
</class>