AudioServer
Inherits: Object
Server interface for low-level audio access.
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
Properties
| ||
| ||
| ||
|
Methods
void | |
void | add_bus_effect ( int bus_idx, AudioEffect effect, int at_position=-1 ) |
generate_bus_layout ( ) const | |
get_bus_channels ( int bus_idx ) const | |
get_bus_effect ( int bus_idx, int effect_idx ) | |
get_bus_effect_count ( int bus_idx ) | |
get_bus_effect_instance ( int bus_idx, int effect_idx, int channel=0 ) | |
get_bus_index ( String bus_name ) const | |
get_bus_name ( int bus_idx ) const | |
get_bus_peak_volume_left_db ( int bus_idx, int channel ) const | |
get_bus_peak_volume_right_db ( int bus_idx, int channel ) const | |
get_bus_send ( int bus_idx ) const | |
get_bus_volume_db ( int bus_idx ) const | |
get_device_list ( ) | |
get_mix_rate ( ) const | |
get_output_latency ( ) const | |
get_speaker_mode ( ) const | |
get_time_since_last_mix ( ) const | |
get_time_to_next_mix ( ) const | |
is_bus_bypassing_effects ( int bus_idx ) const | |
is_bus_effect_enabled ( int bus_idx, int effect_idx ) const | |
is_bus_mute ( int bus_idx ) const | |
is_bus_solo ( int bus_idx ) const | |
void | lock ( ) |
void | |
void | remove_bus ( int index ) |
void | remove_bus_effect ( int bus_idx, int effect_idx ) |
void | set_bus_bypass_effects ( int bus_idx, bool enable ) |
void | set_bus_effect_enabled ( int bus_idx, int effect_idx, bool enabled ) |
void | set_bus_layout ( AudioBusLayout bus_layout ) |
void | set_bus_mute ( int bus_idx, bool enable ) |
void | set_bus_name ( int bus_idx, String name ) |
void | set_bus_send ( int bus_idx, String send ) |
void | set_bus_solo ( int bus_idx, bool enable ) |
void | set_bus_volume_db ( int bus_idx, float volume_db ) |
void | swap_bus_effects ( int bus_idx, int effect_idx, int by_effect_idx ) |
void | unlock ( ) |
Signals
- bus_layout_changed ( )
Emitted when the AudioBusLayout changes.
Enumerations
enum SpeakerMode:
SPEAKER_MODE_STEREO = 0 —- Two or fewer speakers were detected.
SPEAKER_SURROUND_31 = 1 —- A 3.1 channel surround setup was detected.
SPEAKER_SURROUND_51 = 2 —- A 5.1 channel surround setup was detected.
SPEAKER_SURROUND_71 = 3 —- A 7.1 channel surround setup was detected.
Property Descriptions
- int bus_count
Default |
|
Setter | set_bus_count(value) |
Getter | get_bus_count() |
Number of available audio buses.
- String capture_device
Default |
|
Setter | capture_set_device(value) |
Getter | capture_get_device() |
Name of the current device for audio input (see 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 "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"
.
- String device
Default |
|
Setter | set_device(value) |
Getter | get_device() |
Name of the current device for audio output (see 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 "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"
.
- float global_rate_scale
Default |
|
Setter | set_global_rate_scale(value) |
Getter | get_global_rate_scale() |
Scales the rate at which audio is played (i.e. setting it to 0.5
will make the audio be played twice as fast).
Method Descriptions
- void add_bus ( int at_position=-1 )
Adds a bus at at_position
.
- void add_bus_effect ( int bus_idx, AudioEffect effect, int at_position=-1 )
Adds an AudioEffect effect to the bus bus_idx
at at_position
.
- Array capture_get_device_list ( )
Returns the names of all audio input devices detected on the system.
- AudioBusLayout generate_bus_layout ( ) const
Generates an AudioBusLayout using the available buses and effects.
Returns the amount of channels of the bus at index bus_idx
.
- AudioEffect get_bus_effect ( int bus_idx, int effect_idx )
Returns the AudioEffect at position effect_idx
in bus bus_idx
.
Returns the number of effects on the bus at bus_idx
.
- AudioEffectInstance get_bus_effect_instance ( int bus_idx, int effect_idx, int channel=0 )
Returns the AudioEffectInstance assigned to the given bus and effect indices (and optionally channel).
Returns the index of the bus with the name bus_name
.
Returns the name of the bus with the index bus_idx
.
Returns the peak volume of the left speaker at bus index bus_idx
and channel index channel
.
Returns the peak volume of the right speaker at bus index bus_idx
and channel index channel
.
Returns the name of the bus that the bus at index bus_idx
sends to.
Returns the volume of the bus at index bus_idx
in dB.
- Array get_device_list ( )
Returns the names of all audio devices detected on the system.
- float get_mix_rate ( ) const
Returns the sample rate at the output of the AudioServer
.
- float get_output_latency ( ) const
Returns the audio driver’s output latency.
- SpeakerMode get_speaker_mode ( ) const
Returns the speaker configuration.
- float get_time_since_last_mix ( ) const
Returns the relative time since the last mix occurred.
- float get_time_to_next_mix ( ) const
Returns the relative time until the next mix occurs.
If true
, the bus at index bus_idx
is bypassing effects.
If true
, the effect at index effect_idx
on the bus at index bus_idx
is enabled.
If true
, the bus at index bus_idx
is muted.
If true
, the bus at index bus_idx
is in solo mode.
- void lock ( )
Locks the audio driver’s main loop.
Note: Remember to unlock it afterwards.
Moves the bus from index index
to index to_index
.
- void remove_bus ( int index )
Removes the bus at index index
.
Removes the effect at index effect_idx
from the bus at index bus_idx
.
If true
, the bus at index bus_idx
is bypassing effects.
If true
, the effect at index effect_idx
on the bus at index bus_idx
is enabled.
- void set_bus_layout ( AudioBusLayout bus_layout )
Overwrites the currently used AudioBusLayout.
If true
, the bus at index bus_idx
is muted.
Sets the name of the bus at index bus_idx
to name
.
Connects the output of the bus at bus_idx
to the bus named send
.
If true
, the bus at index bus_idx
is in solo mode.
Sets the volume of the bus at index bus_idx
to volume_db
.
Swaps the position of two effects in bus bus_idx
.
- void unlock ( )
Unlocks the audio driver’s main loop. (After locking it, you should always unlock it.)