Documentation
¶
Overview ¶
graphics.gd/classdb/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.
Index ¶
- func AddBus()
- func AddBusEffect(bus_idx Bus, effect AudioEffect.Instance)
- func AddBusEffectOptions(bus_idx Bus, effect AudioEffect.Instance, at_position int)
- func AddBusOptions(at_position int)
- func Advanced() class
- func BusCount() int
- func GenerateBusLayout() AudioBusLayout.Instance
- func GetBusChannels(bus_idx Bus) int
- func GetBusEffect(bus_idx Bus, effect_idx Effect) AudioEffect.Instance
- func GetBusEffectCount(bus_idx Bus) int
- func GetBusEffectInstance(bus_idx Bus, effect_idx Effect, channel int) AudioEffectInstance.Instance
- func GetBusEffectInstanceOptions(bus_idx Bus, effect_idx Effect, channel int) AudioEffectInstance.Instance
- func GetBusIndex(bus_name string) int
- func GetBusName(bus_idx Bus) string
- func GetBusPeakVolumeLeftDb(bus_idx Bus, channel int) Float.X
- func GetBusPeakVolumeRightDb(bus_idx Bus, channel int) Float.X
- func GetBusSend(bus_idx Bus) string
- func GetBusVolumeDb(bus_idx Bus) Float.X
- func GetBusVolumeLinear(bus_idx Bus) Float.X
- func GetDriverName() string
- func GetInputDeviceList() []string
- func GetInputMixRate() Float.X
- func GetMixRate() Float.X
- func GetOutputDeviceList() []string
- func GetOutputLatency() Float.X
- func GetTimeSinceLastMix() Float.X
- func GetTimeToNextMix() Float.X
- func InputDevice() string
- func IsBusBypassingEffects(bus_idx Bus) bool
- func IsBusEffectEnabled(bus_idx Bus, effect_idx Effect) bool
- func IsBusMute(bus_idx Bus) bool
- func IsBusSolo(bus_idx Bus) bool
- func IsStreamRegisteredAsSample(stream AudioStream.Instance) bool
- func Lock()
- func MoveBus(index Bus, to_index Bus)
- func OnBusLayoutChanged(cb func(), flags ...Signal.Flags)
- func OnBusRenamed(cb func(bus_index Bus, old_name string, new_name string), ...)
- func OutputDevice() string
- func PlaybackSpeedScale() Float.X
- func RegisterStreamAsSample(stream AudioStream.Instance)
- func RemoveBus(index Bus)
- func RemoveBusEffect(bus_idx Bus, effect_idx Effect)
- func SetBusBypassEffects(bus_idx Bus, enable bool)
- func SetBusCount(value int)
- func SetBusEffectEnabled(bus_idx Bus, effect_idx Effect, enabled bool)
- func SetBusLayout(bus_layout AudioBusLayout.Instance)
- func SetBusMute(bus_idx Bus, enable bool)
- func SetBusName(bus_idx Bus, name string)
- func SetBusSend(bus_idx Bus, send string)
- func SetBusSolo(bus_idx Bus, enable bool)
- func SetBusVolumeDb(bus_idx Bus, volume_db Float.X)
- func SetBusVolumeLinear(bus_idx Bus, volume_linear Float.X)
- func SetEnableTaggingUsedAudioStreams(enable bool)
- func SetInputDevice(value string)
- func SetOutputDevice(value string)
- func SetPlaybackSpeedScale(value Float.X)
- func SwapBusEffects(bus_idx Bus, effect_idx Effect, by_effect_idx Effect)
- func Unlock()
- type Bus
- type Effect
- type Extension
- type ID
- type Instance
- type PlaybackType
- type SpeakerMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBusEffect ¶
func AddBusEffect(bus_idx Bus, effect AudioEffect.Instance)
Adds an graphics.gd/classdb/AudioEffect effect to the bus 'bus_idx' at 'at_position'.
func AddBusEffectOptions ¶
func AddBusEffectOptions(bus_idx Bus, effect AudioEffect.Instance, at_position int)
Adds an graphics.gd/classdb/AudioEffect effect to the bus 'bus_idx' at 'at_position'.
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func GenerateBusLayout ¶
func GenerateBusLayout() AudioBusLayout.Instance
Generates an graphics.gd/classdb/AudioBusLayout using the available buses and effects.
func GetBusChannels ¶
Returns the number of channels of the bus at index 'bus_idx'.
func GetBusEffect ¶
func GetBusEffect(bus_idx Bus, effect_idx Effect) AudioEffect.Instance
Returns the graphics.gd/classdb/AudioEffect at position 'effect_idx' in bus 'bus_idx'.
func GetBusEffectCount ¶
Returns the number of effects on the bus at 'bus_idx'.
func GetBusEffectInstance ¶
func GetBusEffectInstance(bus_idx Bus, effect_idx Effect, channel int) AudioEffectInstance.Instance
Returns the graphics.gd/classdb/AudioEffectInstance assigned to the given bus and effect indices (and optionally channel).
func GetBusEffectInstanceOptions ¶
func GetBusEffectInstanceOptions(bus_idx Bus, effect_idx Effect, channel int) AudioEffectInstance.Instance
Returns the graphics.gd/classdb/AudioEffectInstance assigned to the given bus and effect indices (and optionally channel).
func GetBusIndex ¶
Returns the index of the bus with the name 'bus_name'. Returns -1 if no bus with the specified name exist.
func GetBusName ¶
Returns the name of the bus with the index 'bus_idx'.
func GetBusPeakVolumeLeftDb ¶
Returns the peak volume of the left speaker at bus index 'bus_idx' and channel index 'channel'.
func GetBusPeakVolumeRightDb ¶
Returns the peak volume of the right speaker at bus index 'bus_idx' and channel index 'channel'.
func GetBusSend ¶
Returns the name of the bus that the bus at index 'bus_idx' sends to.
func GetBusVolumeDb ¶
Returns the volume of the bus at index 'bus_idx' in dB.
func GetBusVolumeLinear ¶
Returns the volume of the bus at index 'bus_idx' as a linear value.
Note: The returned value is equivalent to the result of [graphics.gd/classdb/@GlobalScope.Instance.DbToLinear] on the result of GetBusVolumeDb.
func GetDriverName ¶
func GetDriverName() string
Returns the name of the current audio driver. The default usually depends on the operating system, but may be overridden via the --audio-driver command line argument. --headless also automatically sets the audio driver to Dummy. See also graphics.gd/classdb/ProjectSettings "audio/driver/driver".
func GetInputDeviceList ¶
func GetInputDeviceList() []string
Returns the names of all audio input devices detected on the system.
Note: graphics.gd/classdb/ProjectSettings "audio/driver/enable_input" must be true for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
func GetInputMixRate ¶
Returns the sample rate at the input of the graphics.gd/classdb/AudioServer.
func GetMixRate ¶
Returns the sample rate at the output of the graphics.gd/classdb/AudioServer.
func GetOutputDeviceList ¶
func GetOutputDeviceList() []string
Returns the names of all audio output devices detected on the system.
func GetOutputLatency ¶
Returns the audio driver's effective output latency. This is based on graphics.gd/classdb/ProjectSettings "audio/driver/output_latency", but the exact returned value will differ depending on the operating system and audio driver.
Note: This can be expensive; it is not recommended to call GetOutputLatency every frame.
func GetTimeSinceLastMix ¶
Returns the relative time since the last mix occurred.
func GetTimeToNextMix ¶
Returns the relative time until the next mix occurs.
func InputDevice ¶
func InputDevice() string
func IsBusBypassingEffects ¶
If true, the bus at index 'bus_idx' is bypassing effects.
func IsBusEffectEnabled ¶
If true, the effect at index 'effect_idx' on the bus at index 'bus_idx' is enabled.
func IsStreamRegisteredAsSample ¶
func IsStreamRegisteredAsSample(stream AudioStream.Instance) bool
If true, the stream is registered as a sample. The engine will not have to register it before playing the sample.
If false, the stream will have to be registered before playing it. To prevent lag spikes, register the stream as sample with RegisterStreamAsSample.
func OnBusLayoutChanged ¶
func OnBusRenamed ¶
func OutputDevice ¶
func OutputDevice() string
func PlaybackSpeedScale ¶
func RegisterStreamAsSample ¶
func RegisterStreamAsSample(stream AudioStream.Instance)
Forces the registration of a stream as a sample.
Note: Lag spikes may occur when calling this method, especially on single-threaded builds. It is suggested to call this method while loading assets, where the lag spike could be masked, instead of registering the sample right before it needs to be played.
func RemoveBusEffect ¶
Removes the effect at index 'effect_idx' from the bus at index 'bus_idx'.
func SetBusBypassEffects ¶
If true, the bus at index 'bus_idx' is bypassing effects.
func SetBusCount ¶
func SetBusCount(value int)
func SetBusEffectEnabled ¶
If true, the effect at index 'effect_idx' on the bus at index 'bus_idx' is enabled.
func SetBusLayout ¶
func SetBusLayout(bus_layout AudioBusLayout.Instance)
Overwrites the currently used graphics.gd/classdb/AudioBusLayout.
func SetBusMute ¶
If true, the bus at index 'bus_idx' is muted.
func SetBusName ¶
Sets the name of the bus at index 'bus_idx' to 'name'.
func SetBusSend ¶
Connects the output of the bus at 'bus_idx' to the bus named 'send'.
func SetBusSolo ¶
If true, the bus at index 'bus_idx' is in solo mode.
func SetBusVolumeDb ¶
Sets the volume in decibels of the bus at index 'bus_idx' to 'volume_db'.
func SetBusVolumeLinear ¶
Sets the volume as a linear value of the bus at index 'bus_idx' to 'volume_linear'.
Note: Using this method is equivalent to calling SetBusVolumeDb with the result of [graphics.gd/classdb/@GlobalScope.Instance.LinearToDb] on a value.
func SetEnableTaggingUsedAudioStreams ¶
func SetEnableTaggingUsedAudioStreams(enable bool)
If set to true, all instances of graphics.gd/classdb/AudioStreamPlayback will call graphics.gd/classdb/AudioStreamPlayback.Instance.TagUsedStreams every mix step.
Note: This is enabled by default in the editor, as it is used by editor plugins for the audio stream previews.
func SetInputDevice ¶
func SetInputDevice(value string)
func SetOutputDevice ¶
func SetOutputDevice(value string)
func SetPlaybackSpeedScale ¶
func SwapBusEffects ¶
Swaps the position of two effects in bus 'bus_idx'.
Types ¶
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.AudioServer
Instance of the class with convieniently typed arguments and results.
type PlaybackType ¶
type PlaybackType int //gd:AudioServer.PlaybackType
const ( // The playback will be considered of the type declared at [graphics.gd/classdb/ProjectSettings] "audio/general/default_playback_type". PlaybackTypeDefault PlaybackType = 0 // Force the playback to be considered as a stream. PlaybackTypeStream PlaybackType = 1 // Force the playback to be considered as a sample. This can provide lower latency and more stable playback (with less risk of audio crackling), at the cost of having less flexibility. // // Note: Only currently supported on the web platform. // // Note: [graphics.gd/classdb/AudioEffect]s are not supported when playback is considered as a sample. PlaybackTypeSample PlaybackType = 2 // Represents the size of the [PlaybackType] enum. PlaybackTypeMax PlaybackType = 3 )
type SpeakerMode ¶
type SpeakerMode int //gd:AudioServer.SpeakerMode
const ( // Two or fewer speakers were detected. SpeakerModeStereo SpeakerMode = 0 // A 3.1 channel surround setup was detected. SpeakerSurround31 SpeakerMode = 1 // A 5.1 channel surround setup was detected. SpeakerSurround51 SpeakerMode = 2 // A 7.1 channel surround setup was detected. SpeakerSurround71 SpeakerMode = 3 )