AudioServer
Server interface for low-level audio access.
AudioServer.swift:17class 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.
This object emits the following signals:
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
class Signal1
Signal support.
enum SpeakerMode
Type members
static var busCount: Int32
Number of available audio buses.
static var inputDevice: String
Name of the current device for audio input (see
getInputDeviceList
). 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"
.static var outputDevice: String
Name of the current device for audio output (see
getOutputDeviceList
). 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"
.static var playbackSpeedScale: Double
Scales the rate at which audio is played (i.e. setting it to
0.5
will make the audio be played at half its speed).static func addBus(atPosition: Int32
) Adds a bus at
atPosition
.static func addBusEffect(busIdx: Int32, effect: AudioEffect?, atPosition: Int32
) Adds an
AudioEffect
effect to the busbusIdx
atatPosition
.static func generateBusLayout(
) -> AudioBusLayout? Generates an
AudioBusLayout
using the available buses and effects.static func getBusChannels(busIdx: Int32
) -> Int32 Returns the number of channels of the bus at index
busIdx
.static func getBusEffect(busIdx: Int32, effectIdx: Int32
) -> AudioEffect? Returns the
AudioEffect
at positioneffectIdx
in busbusIdx
.static func getBusEffectCount(busIdx: Int32
) -> Int32 Returns the number of effects on the bus at
busIdx
.static func getBusEffectInstance(busIdx: Int32, effectIdx: Int32, channel: Int32
) -> AudioEffectInstance? Returns the
AudioEffectInstance
assigned to the given bus and effect indices (and optionally channel).static func getBusIndex(busName: StringName
) -> Int32 Returns the index of the bus with the name
busName
. Returns-1
if no bus with the specified name exist.static func getBusName(busIdx: Int32
) -> String Returns the name of the bus with the index
busIdx
.static func getBusPeakVolumeLeftDb(busIdx: Int32, channel: Int32
) -> Double Returns the peak volume of the left speaker at bus index
busIdx
and channel indexchannel
.static func getBusPeakVolumeRightDb(busIdx: Int32, channel: Int32
) -> Double Returns the peak volume of the right speaker at bus index
busIdx
and channel indexchannel
.static func getBusSend(busIdx: Int32
) -> StringName Returns the name of the bus that the bus at index
busIdx
sends to.static func getBusVolumeDb(busIdx: Int32
) -> Double Returns the volume of the bus at index
busIdx
in dB.static func getInputDeviceList(
) -> PackedStringArray Returns the names of all audio input devices detected on the system.
static func getMixRate(
) -> Double Returns the sample rate at the output of the
AudioServer
.static func getOutputDeviceList(
) -> PackedStringArray Returns the names of all audio output devices detected on the system.
static func getOutputLatency(
) -> Double Returns the audio driver’s effective output latency. This is based on
ProjectSettings/audio/driver/outputLatency
, but the exact returned value will differ depending on the operating system and audio driver.static func getSpeakerMode(
) -> AudioServer.SpeakerMode Returns the speaker configuration.
static func getTimeSinceLastMix(
) -> Double Returns the relative time since the last mix occurred.
static func getTimeToNextMix(
) -> Double Returns the relative time until the next mix occurs.
static func isBusBypassingEffects(busIdx: Int32
) -> Bool If
true
, the bus at indexbusIdx
is bypassing effects.static func isBusEffectEnabled(busIdx: Int32, effectIdx: Int32
) -> Bool If
true
, the effect at indexeffectIdx
on the bus at indexbusIdx
is enabled.static func isBusMute(busIdx: Int32
) -> Bool If
true
, the bus at indexbusIdx
is muted.static func isBusSolo(busIdx: Int32
) -> Bool If
true
, the bus at indexbusIdx
is in solo mode.static func lock(
) Locks the audio driver’s main loop.
static func moveBus(index: Int32, toIndex: Int32
) Moves the bus from index
index
to indextoIndex
.static func removeBus(index: Int32
) Removes the bus at index
index
.static func removeBusEffect(busIdx: Int32, effectIdx: Int32
) Removes the effect at index
effectIdx
from the bus at indexbusIdx
.static func setBusBypassEffects(busIdx: Int32, enable: Bool
) If
true
, the bus at indexbusIdx
is bypassing effects.static func setBusEffectEnabled(busIdx: Int32, effectIdx: Int32, enabled: Bool
) If
true
, the effect at indexeffectIdx
on the bus at indexbusIdx
is enabled.static func setBusLayout(AudioBusLayout?
) Overwrites the currently used
AudioBusLayout
.static func setBusMute(busIdx: Int32, enable: Bool
) If
true
, the bus at indexbusIdx
is muted.static func setBusName(busIdx: Int32, name: String
) Sets the name of the bus at index
busIdx
toname
.static func setBusSend(busIdx: Int32, send: StringName
) Connects the output of the bus at
busIdx
to the bus namedsend
.static func setBusSolo(busIdx: Int32, enable: Bool
) If
true
, the bus at indexbusIdx
is in solo mode.static func setBusVolumeDb(busIdx: Int32, volumeDb: Double
) Sets the volume of the bus at index
busIdx
tovolumeDb
.static func setEnableTaggingUsedAudioStreams(enable: Bool
) static func swapBusEffects(busIdx: Int32, effectIdx: Int32, byEffectIdx: Int32
) Swaps the position of two effects in bus
busIdx
.static func unlock(
) Unlocks the audio driver’s main loop. (After locking it, you should always unlock it.)
class var godotClassName: StringName
Instance members
var busLayoutChanged: SimpleSignal
Emitted when an audio bus is added, deleted, or moved.
var busRenamed: Signal1
Emitted when the audio bus at
busIndex
is renamed fromoldName
tonewName
.