Server interface for low-level audio access.
    public static class AudioServer

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.

Inheritance Chain

Static Properties

    public static int BusCount { get; set; }

Number of available audio buses.

    public static string CaptureDevice { get; set; }

Name of the current device for audio input (see CaptureGetDeviceList()).

    public static string Device { get; set; }

Name of the current device for audio output (see GetDeviceList()).

    public static float GlobalRateScale { get; set; }

Scales the rate at which audio is played (i.e. setting it to 0.5 will make the audio be played twice as fast).

    public static Object Singleton { get; }

Static Methods

    public static void AddBus(int atPosition = -1)

Adds a bus at atPosition.

    public static void AddBusEffect(int busIdx, AudioEffect effect, int atPosition = -1)

Adds an AudioEffect effect to the bus busIdx at atPosition.

    [Obsolete("CaptureGetDevice is deprecated. Use the CaptureDevice property instead.")]
    public static string CaptureGetDevice()

Getter for CaptureDevice

    public static Godot.Collections.Array CaptureGetDeviceList()

Returns the names of all audio input devices detected on the system.

    [Obsolete("CaptureSetDevice is deprecated. Use the CaptureDevice property instead.")]
    public static void CaptureSetDevice(string name)

Setter for CaptureDevice

    public static Error CaptureStart()

Attempts to start recording from the audio driver’s capture device. On success, the return value is [constant OK].

    public static Error CaptureStop()

Attempts to stop recording from the audio driver’s capture device. On success, the return value is [constant OK].

    public static AudioBusLayout GenerateBusLayout()

Generates an AudioBusLayout using the available buses and effects.

    public static int GetBusChannels(int busIdx)

Returns the amount of channels of the bus at index busIdx.

    [Obsolete("GetBusCount is deprecated. Use the BusCount property instead.")]
    public static int GetBusCount()

Getter for BusCount

    public static AudioEffect GetBusEffect(int busIdx, int effectIdx)

Returns the AudioEffect at position effectIdx in bus busIdx.

    public static int GetBusEffectCount(int busIdx)

Returns the number of effects on the bus at busIdx.

    public static AudioEffectInstance GetBusEffectInstance(int busIdx, int effectIdx, int channel = 0)

    public static int GetBusIndex(string busName)

Returns the index of the bus with the name busName.

    public static string GetBusName(int busIdx)

Returns the name of the bus with the index busIdx.

    public static float GetBusPeakVolumeLeftDb(int busIdx, int channel)

Returns the peak volume of the left speaker at bus index busIdx and channel index channel.

    public static float GetBusPeakVolumeRightDb(int busIdx, int channel)

Returns the peak volume of the right speaker at bus index busIdx and channel index channel.

    public static string GetBusSend(int busIdx)

Returns the name of the bus that the bus at index busIdx sends to.

    public static float GetBusVolumeDb(int busIdx)

Returns the volume of the bus at index busIdx in dB.

    public static int[] GetCaptureBuffer()

Returns an PoolIntArray containing audio frames from the capture device.

    public static uint GetCapturePosition()

    public static uint GetCaptureSize()

    [Obsolete("GetDevice is deprecated. Use the Device property instead.")]
    public static string GetDevice()

Getter for Device

    public static Godot.Collections.Array GetDeviceList()

Returns the names of all audio output devices detected on the system.

    [Obsolete("GetGlobalRateScale is deprecated. Use the GlobalRateScale property instead.")]
    public static float GetGlobalRateScale()

Getter for GlobalRateScale

    public static float GetMixRate()

Returns the sample rate at the output of the AudioServer.

    public static double GetOutputLatency()

    public static SpeakerMode GetSpeakerMode()

Returns the speaker configuration.

    public static double GetTimeSinceLastMix()

    public static double GetTimeToNextMix()

    public static bool IsBusBypassingEffects(int busIdx)

If true, the bus at index busIdx is bypassing effects.

    public static bool IsBusEffectEnabled(int busIdx, int effectIdx)

If true, the effect at index effectIdx on the bus at index busIdx is enabled.

    public static bool IsBusMute(int busIdx)

If true, the bus at index busIdx is muted.

    public static bool IsBusSolo(int busIdx)

If true, the bus at index busIdx is in solo mode.

    public static void Lock()

Locks the audio driver’s main loop. Remember to unlock it afterwards.

    public static void MoveBus(int index, int toIndex)

Moves the bus from index index to index toIndex.

    public static void RemoveBus(int index)

Removes the bus at index index.

    public static void RemoveBusEffect(int busIdx, int effectIdx)

Removes the effect at index effectIdx from the bus at index busIdx.

    public static void SetBusBypassEffects(int busIdx, bool enable)

If true, the bus at index busIdx is bypassing effects.

    [Obsolete("SetBusCount is deprecated. Use the BusCount property instead.")]
    public static void SetBusCount(int amount)

Setter for BusCount

    public static void SetBusEffectEnabled(int busIdx, int effectIdx, bool enabled)

If true, the effect at index effectIdx on the bus at index busIdx is enabled.

    public static void SetBusLayout(AudioBusLayout busLayout)

Overwrites the currently used AudioBusLayout.

    public static void SetBusMute(int busIdx, bool enable)

If true, the bus at index busIdx is muted.

    public static void SetBusName(int busIdx, string name)

Sets the name of the bus at index busIdx to name.

    public static void SetBusSend(int busIdx, string send)

Connects the output of the bus at busIdx to the bus named send.

    public static void SetBusSolo(int busIdx, bool enable)

If true, the bus at index busIdx is in solo mode.

    public static void SetBusVolumeDb(int busIdx, float volumeDb)

Sets the volume of the bus at index busIdx to volumeDb.

    [Obsolete("SetDevice is deprecated. Use the Device property instead.")]
    public static void SetDevice(string device)

Setter for Device

    [Obsolete("SetGlobalRateScale is deprecated. Use the GlobalRateScale property instead.")]
    public static void SetGlobalRateScale(float scale)

Setter for GlobalRateScale

    public static void SwapBusEffects(int busIdx, int effectIdx, int byEffectIdx)

Swaps the position of two effects in bus busIdx.

    public static void Unlock()

Unlocks the audio driver’s main loop. (After locking it, you should always unlock it.)

Signals

    "audio_mix_callback" ()

    "audio_update_callback" ()

    "bus_layout_changed" ()

Emitted when the AudioBusLayout changes.

Inner Types

SpeakerMode

Name Value Description
ModeStereo 0 Two or fewer speakers were detected.
Surround31 1 A 3.1 channel surround setup was detected.
Surround51 2 A 5.1 channel surround setup was detected.
Surround71 3 A 7.1 channel surround setup was detected.
Tags: