Documentation
¶
Overview ¶
Package AudioServer provides methods for working with AudioServer object instances.
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 int, 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 [AudioEffect] effect to the bus [param bus_idx] at [param at_position].
func AddBusEffectOptions ¶
func AddBusEffectOptions(bus_idx Bus, effect AudioEffect.Instance, at_position int)
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() AudioBusLayout.Instance
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 Bus, effect_idx Effect) AudioEffect.Instance
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 Bus, effect_idx Effect, channel int) AudioEffectInstance.Instance
Returns the [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 [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 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 AudioStream.Instance) 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 OnBusRenamed ¶
func OutputDevice ¶
func OutputDevice() string
func PlaybackSpeedScale ¶
func RegisterStreamAsSample ¶
func RegisterStreamAsSample(stream AudioStream.Instance)
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 AudioBusLayout.Instance)
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 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
[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.
type PlaybackType ¶
type PlaybackType int //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 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 )