Documentation
¶
Overview ¶
Package AudioServer provides methods for working with AudioServer object instances.
Index ¶
- func AddBus()
- func AddBusEffect(bus_idx int, effect [1]gdclass.AudioEffect)
- func Advanced() class
- func BusCount() int
- func GenerateBusLayout() [1]gdclass.AudioBusLayout
- func GetBusChannels(bus_idx int) int
- func GetBusEffect(bus_idx int, effect_idx int) [1]gdclass.AudioEffect
- func GetBusEffectCount(bus_idx int) int
- func GetBusEffectInstance(bus_idx int, effect_idx int) [1]gdclass.AudioEffectInstance
- func GetBusIndex(bus_name string) int
- func GetBusName(bus_idx int) string
- func GetBusPeakVolumeLeftDb(bus_idx int, channel int) Float.X
- func GetBusPeakVolumeRightDb(bus_idx int, channel int) Float.X
- func GetBusSend(bus_idx int) string
- func GetBusVolumeDb(bus_idx int) Float.X
- func GetBusVolumeLinear(bus_idx int) Float.X
- func GetDriverName() string
- func GetInputDeviceList() []string
- func GetInputMixRate() Float.X
- func GetMixRate() Float.X
- func GetOutputDeviceList() []string
- func GetOutputLatency() Float.X
- func GetSpeakerMode() gdclass.AudioServerSpeakerMode
- func GetTimeSinceLastMix() Float.X
- func GetTimeToNextMix() Float.X
- func InputDevice() string
- func IsBusBypassingEffects(bus_idx int) bool
- func IsBusEffectEnabled(bus_idx int, effect_idx int) bool
- func IsBusMute(bus_idx int) bool
- func IsBusSolo(bus_idx int) bool
- func IsStreamRegisteredAsSample(stream [1]gdclass.AudioStream) bool
- func Lock()
- func MoveBus(index int, to_index int)
- func OnBusLayoutChanged(cb func())
- func OnBusRenamed(cb func(bus_index int, old_name string, new_name string))
- func OutputDevice() string
- func PlaybackSpeedScale() Float.X
- func RegisterStreamAsSample(stream [1]gdclass.AudioStream)
- func RemoveBus(index int)
- func RemoveBusEffect(bus_idx int, effect_idx int)
- func SetBusBypassEffects(bus_idx int, enable bool)
- func SetBusCount(value int)
- func SetBusEffectEnabled(bus_idx int, effect_idx int, enabled bool)
- func SetBusLayout(bus_layout [1]gdclass.AudioBusLayout)
- func SetBusMute(bus_idx int, enable bool)
- func SetBusName(bus_idx int, name string)
- func SetBusSend(bus_idx int, send string)
- func SetBusSolo(bus_idx int, enable bool)
- func SetBusVolumeDb(bus_idx int, volume_db Float.X)
- func SetBusVolumeLinear(bus_idx int, 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 int, effect_idx int, by_effect_idx int)
- func Unlock()
- type PlaybackType
- type SpeakerMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBusEffect ¶
func AddBusEffect(bus_idx int, effect [1]gdclass.AudioEffect)
Adds an [AudioEffect] effect to the bus [param bus_idx] at [param 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() [1]gdclass.AudioBusLayout
Generates an [AudioBusLayout] using the available buses and effects.
func GetBusChannels ¶
Returns the number of channels of the bus at index [param bus_idx].
func GetBusEffect ¶
func GetBusEffect(bus_idx int, effect_idx int) [1]gdclass.AudioEffect
Returns the [AudioEffect] at position [param effect_idx] in bus [param bus_idx].
func GetBusEffectCount ¶
Returns the number of effects on the bus at [param bus_idx].
func GetBusEffectInstance ¶
func GetBusEffectInstance(bus_idx int, effect_idx int) [1]gdclass.AudioEffectInstance
Returns the [AudioEffectInstance] assigned to the given bus and effect indices (and optionally channel).
func GetBusIndex ¶
Returns the index of the bus with the name [param bus_name]. Returns [code]-1[/code] if no bus with the specified name exist.
func GetBusName ¶
Returns the name of the bus with the index [param bus_idx].
func GetBusPeakVolumeLeftDb ¶
Returns the peak volume of the left speaker at bus index [param bus_idx] and channel index [param channel].
func GetBusPeakVolumeRightDb ¶
Returns the peak volume of the right speaker at bus index [param bus_idx] and channel index [param channel].
func GetBusSend ¶
Returns the name of the bus that the bus at index [param bus_idx] sends to.
func GetBusVolumeDb ¶
Returns the volume of the bus at index [param bus_idx] in dB.
func GetBusVolumeLinear ¶
Returns the volume of the bus at index [param bus_idx] as a linear value. [b]Note:[/b] The returned value is equivalent to the result of [method @GlobalScope.db_to_linear] on the result of [method get_bus_volume_db].
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 [code]--audio-driver[/code] [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url]. [code]--headless[/code] also automatically sets the audio driver to [code]Dummy[/code]. See also [member ProjectSettings.audio/driver/driver].
func GetInputDeviceList ¶
func GetInputDeviceList() []string
Returns the names of all audio input devices detected on the system. [b]Note:[/b] [member ProjectSettings.audio/driver/enable_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.
func GetInputMixRate ¶
Returns the sample rate at the input of the [AudioServer].
func GetMixRate ¶
Returns the sample rate at the output of the [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 [member ProjectSettings.audio/driver/output_latency], but the exact returned value will differ depending on the operating system and audio driver. [b]Note:[/b] This can be expensive; it is not recommended to call [method get_output_latency] every frame.
func GetSpeakerMode ¶
func GetSpeakerMode() gdclass.AudioServerSpeakerMode
Returns the speaker configuration.
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 [code]true[/code], the bus at index [param bus_idx] is bypassing effects.
func IsBusEffectEnabled ¶
If [code]true[/code], the effect at index [param effect_idx] on the bus at index [param bus_idx] is enabled.
func IsStreamRegisteredAsSample ¶
func IsStreamRegisteredAsSample(stream [1]gdclass.AudioStream) bool
If [code]true[/code], the stream is registered as a sample. The engine will not have to register it before playing the sample. If [code]false[/code], the stream will have to be registered before playing it. To prevent lag spikes, register the stream as sample with [method register_stream_as_sample].
func Lock ¶
func Lock()
Locks the audio driver's main loop. [b]Note:[/b] Remember to unlock it afterwards.
func OnBusLayoutChanged ¶
func OnBusLayoutChanged(cb func())
func OnBusRenamed ¶
func OutputDevice ¶
func OutputDevice() string
func PlaybackSpeedScale ¶
func RegisterStreamAsSample ¶
func RegisterStreamAsSample(stream [1]gdclass.AudioStream)
Forces the registration of a stream as a sample. [b]Note:[/b] 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 [param effect_idx] from the bus at index [param bus_idx].
func SetBusBypassEffects ¶
If [code]true[/code], the bus at index [param bus_idx] is bypassing effects.
func SetBusCount ¶
func SetBusCount(value int)
func SetBusEffectEnabled ¶
If [code]true[/code], the effect at index [param effect_idx] on the bus at index [param bus_idx] is enabled.
func SetBusLayout ¶
func SetBusLayout(bus_layout [1]gdclass.AudioBusLayout)
Overwrites the currently used [AudioBusLayout].
func SetBusMute ¶
If [code]true[/code], the bus at index [param bus_idx] is muted.
func SetBusName ¶
Sets the name of the bus at index [param bus_idx] to [param name].
func SetBusSend ¶
Connects the output of the bus at [param bus_idx] to the bus named [param send].
func SetBusSolo ¶
If [code]true[/code], the bus at index [param bus_idx] is in solo mode.
func SetBusVolumeDb ¶
Sets the volume in decibels of the bus at index [param bus_idx] to [param volume_db].
func SetBusVolumeLinear ¶
Sets the volume as a linear value of the bus at index [param bus_idx] to [param volume_linear]. [b]Note:[/b] Using this method is equivalent to calling [method set_bus_volume_db] with the result of [method @GlobalScope.linear_to_db] on a value.
func SetEnableTaggingUsedAudioStreams ¶
func SetEnableTaggingUsedAudioStreams(enable bool)
If set to [code]true[/code], all instances of [AudioStreamPlayback] will call [method AudioStreamPlayback._tag_used_streams] every mix step. [b]Note:[/b] 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 [param bus_idx].
Types ¶
type PlaybackType ¶
type PlaybackType = gdclass.AudioServerPlaybackType //gd:AudioServer.PlaybackType
const ( /*The playback will be considered of the type declared at [member 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. [b]Note:[/b] Only currently supported on the web platform. [b]Note:[/b] [AudioEffect]s are not supported when playback is considered as a sample.*/ PlaybackTypeSample PlaybackType = 2 /*Represents the size of the [enum PlaybackType] enum.*/ PlaybackTypeMax PlaybackType = 3 )
type SpeakerMode ¶
type SpeakerMode = gdclass.AudioServerSpeakerMode //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 )