-
Notifications
You must be signed in to change notification settings - Fork 0
AudioServer
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.AudioServer |
| Namespace | Electron2D |
| Kind | class |
| Category | Audio |
Provides process-wide audio device, bus and voice playback state.
public static class Electron2D.AudioServerProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: AudioServer
Process-wide audio query boundary with mix rate, output latency, speaker mode, Master, user buses, routing path, bus volume, mute, solo and lock/unlock. Internal voice handles are not public API.
AudioServer is the public boundary for querying audio output state.
It keeps concrete platform backend handles internal to the runtime.
Electron2D 0.1.0 Preview exposes the default Master bus,
user-defined buses, simple volume routing, mute and solo state. Audio
effects and editor-side bus layout editing are not part of this preview
server surface.
All public methods synchronize access to process-wide audio state. Calls to
Electron2D.AudioServer.Lock and Electron2D.AudioServer.Unlock must be balanced on the same
thread.
This class is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamElectron2D.AudioStreamPlayerElectron2D.AudioStreamPlayer2D
| Member | Kind | Summary |
|---|---|---|
AddBus(System.Int32) |
Method | Adds a user audio bus. |
GetBusCount() |
Method | Gets the number of audio buses available to the server. |
GetBusIndex(System.String) |
Method | Gets the index of an audio bus by name. |
GetBusName(System.Int32) |
Method | Gets the name of an audio bus by index. |
GetBusSend(System.Int32) |
Method | Gets the target bus that receives a bus output. |
GetBusVolumeDb(System.Int32) |
Method | Gets a bus volume offset in decibels. |
GetBusVolumeLinear(System.Int32) |
Method | Gets a bus volume as linear gain. |
GetMixRate() |
Method | Gets the audio mix rate in hertz. |
GetOutputLatency() |
Method | Gets the current audio output latency estimate. |
GetSpeakerMode() |
Method | Gets the speaker layout reported by the active audio output. |
IsBusMute(System.Int32) |
Method | Checks whether a bus is muted. |
IsBusSolo(System.Int32) |
Method | Checks whether a bus is soloed. |
Lock() |
Method | Locks the audio server for a group of audio changes. |
MoveBus(System.Int32, System.Int32) |
Method | Moves a user audio bus to a different index. |
RemoveBus(System.Int32) |
Method | Removes a user audio bus. |
SetBusCount(System.Int32) |
Method | Changes the number of audio buses. |
SetBusMute(System.Int32, System.Boolean) |
Method | Enables or disables mute for a bus. |
SetBusName(System.Int32, System.String) |
Method | Changes the name of a user audio bus. |
SetBusSend(System.Int32, Electron2D.StringName) |
Method | Changes the target bus that receives a user bus output. |
SetBusSolo(System.Int32, System.Boolean) |
Method | Enables or disables solo for a bus. |
SetBusVolumeDb(System.Int32, System.Single) |
Method | Sets a bus volume offset in decibels. |
SetBusVolumeLinear(System.Int32, System.Single) |
Method | Sets a bus volume as linear gain. |
Unlock() |
Method | Unlocks the audio server after a grouped audio change. |
Kind: Method
public static System.Void AddBus(System.Int32)(System.Int32 atPosition)Adds a user audio bus.
Master is fixed at index 0, so explicit insertion
positions must be from 1 through Electron2D.AudioServer.GetBusCount.
The new bus gets a unique default name and sends to Master.
-
atPosition: The insertion index, or-1to append the bus at the end.
-
System.ArgumentOutOfRangeException: Thrown whenatPositionis outside the valid range.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.SetBusName(System.Int32,System.String)Electron2D.AudioServer.SetBusSend(System.Int32,Electron2D.StringName)
Kind: Method
public static System.Int32 GetBusCount()()Gets the number of audio buses available to the server.
The bus count is always at least 1 because Master cannot
be removed. User buses are stored in process-wide audio server state and
are applied to voices started after a bus change.
The number of buses, including the default Master bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusIndex(System.String)Electron2D.AudioServer.GetBusName(System.Int32)
Kind: Method
public static System.Int32 GetBusIndex(System.String)(System.String busName)Gets the index of an audio bus by name.
Bus lookup is case-sensitive. The method returns -1 when no bus
currently has busName.
-
busName: The bus name to search for.
The zero-based bus index, or -1 when no bus has the requested name.
-
System.ArgumentException: Thrown whenbusNameis empty or whitespace. -
System.ArgumentNullException: Thrown whenbusNameisnull.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusName(System.Int32)
Kind: Method
public static System.String GetBusName(System.Int32)(System.Int32 busIdx)Gets the name of an audio bus by index.
Index 0 is always named Master. User buses occupy
positive indices and may be reordered with Electron2D.AudioServer.MoveBus(System.Int32,System.Int32).
-
busIdx: The zero-based bus index to query.
The bus name.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusCountElectron2D.AudioServer.GetBusIndex(System.String)
Kind: Method
public static Electron2D.StringName GetBusSend(System.Int32)(System.Int32 busIdx)Gets the target bus that receives a bus output.
User buses default to sending to Master. Master has no
send target and returns an empty value.
-
busIdx: The bus index to query.
The target bus name, or an empty Electron2D.StringName for
Master.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.SetBusSend(System.Int32,Electron2D.StringName)
Kind: Method
public static System.Single GetBusVolumeDb(System.Int32)(System.Int32 busIdx)Gets a bus volume offset in decibels.
This value is stored on the bus itself. It does not include the volume of any other bus on the routing path.
-
busIdx: The bus index to query.
The bus decibel volume offset.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusVolumeLinear(System.Int32)Electron2D.AudioServer.SetBusVolumeDb(System.Int32,System.Single)
Kind: Method
public static System.Single GetBusVolumeLinear(System.Int32)(System.Int32 busIdx)Gets a bus volume as linear gain.
The returned value is converted from the bus decibel volume only. It does not include any routed parent bus.
-
busIdx: The bus index to query.
The bus volume as linear gain.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusVolumeDb(System.Int32)Electron2D.AudioServer.SetBusVolumeLinear(System.Int32,System.Single)
Kind: Method
public static System.Single GetMixRate()()Gets the audio mix rate in hertz.
The preview backend defaults to 48000. Platform backends may
report a different value when the active audio device requires it.
The number of output sample frames mixed per second.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetOutputLatencyElectron2D.AudioServer.GetSpeakerMode
Kind: Method
public static System.Single GetOutputLatency()()Gets the current audio output latency estimate.
The value is an estimate supplied by the active backend. The default
preview backend reports 0 because it does not own a physical
output device.
The estimated output latency in seconds.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetMixRate
Kind: Method
public static Electron2D.AudioServer.SpeakerMode GetSpeakerMode()()Gets the speaker layout reported by the active audio output.
The value is a query result only. Changing speaker layout is handled by platform startup settings and is not exposed in this preview server API.
The current speaker layout.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.SpeakerMode
Kind: Method
public static System.Boolean IsBusMute(System.Int32)(System.Int32 busIdx)Checks whether a bus is muted.
The result describes the bus flag only. It does not inspect parent buses on the routing path.
-
busIdx: The bus index to query.
true when the bus is muted; otherwise false.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.SetBusMute(System.Int32,System.Boolean)
Kind: Method
public static System.Boolean IsBusSolo(System.Int32)(System.Int32 busIdx)Checks whether a bus is soloed.
The result describes the bus flag only. It does not inspect other buses.
-
busIdx: The bus index to query.
true when the bus is soloed; otherwise false.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.SetBusSolo(System.Int32,System.Boolean)
Kind: Method
public static System.Void Lock()()Locks the audio server for a group of audio changes.
Use this method when several audio operations need to be observed as a
single change by the backend. Every successful call must be paired with
Electron2D.AudioServer.Unlock on the same thread.
This method is safe to call from any thread, but the matching
Electron2D.AudioServer.Unlock must be called from the same thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.Unlock
Kind: Method
public static System.Void MoveBus(System.Int32, System.Int32)(System.Int32 index, System.Int32 toIndex)Moves a user audio bus to a different index.
The Master bus remains fixed at index 0. If moving a bus
would leave any user bus sending to itself or to a bus on its right, that
send target is reset to Master.
-
index: The current bus index. -
toIndex: The target bus index.
-
System.ArgumentOutOfRangeException: Thrown when either index is outside the valid bus range. -
System.InvalidOperationException: Thrown whenindexortoIndexis0.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusName(System.Int32)Electron2D.AudioServer.SetBusSend(System.Int32,Electron2D.StringName)
Kind: Method
public static System.Void RemoveBus(System.Int32)(System.Int32 index)Removes a user audio bus.
Removing a bus reroutes remaining buses that sent to it back to
Master. The Master bus at index 0 cannot be
removed.
-
index: The bus index to remove.
-
System.ArgumentOutOfRangeException: Thrown whenindexdoes not identify an existing bus. -
System.InvalidOperationException: Thrown whenindexis0.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.AddBus(System.Int32)Electron2D.AudioServer.SetBusCount(System.Int32)
Kind: Method
public static System.Void SetBusCount(System.Int32)(System.Int32 amount)Changes the number of audio buses.
The value must be at least 1. Increasing the count appends
user buses routed to Master. Decreasing the count removes buses
from the end and reroutes remaining buses whose send target was removed.
The change applies to voices started after the bus layout update. Existing voices keep the playback snapshot created when they started.
-
amount: The requested bus count, including theMasterbus.
-
System.ArgumentOutOfRangeException: Thrown whenamountis less than1.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.AddBus(System.Int32)Electron2D.AudioServer.GetBusCountElectron2D.AudioServer.RemoveBus(System.Int32)
Kind: Method
public static System.Void SetBusMute(System.Int32, System.Boolean)(System.Int32 busIdx, System.Boolean enable)Enables or disables mute for a bus.
A muted bus silences voices whose routing path contains that bus. The change applies to voices started after the state change.
-
busIdx: The bus index to change. -
enable:trueto mute the bus; otherwisefalse.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.IsBusMute(System.Int32)Electron2D.AudioServer.SetBusSolo(System.Int32,System.Boolean)
Kind: Method
public static System.Void SetBusName(System.Int32, System.String)(System.Int32 busIdx, System.String name)Changes the name of a user audio bus.
Bus names are case-sensitive and must be unique. Renaming a bus updates other bus send targets that referenced the old name.
-
busIdx: The bus index to rename. -
name: The new bus name.
-
System.ArgumentException: Thrown whennameis empty, whitespace-only or already used by another bus. -
System.ArgumentNullException: Thrown whennameisnull. -
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus. -
System.InvalidOperationException: Thrown whenbusIdxis0.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusName(System.Int32)
Kind: Method
public static System.Void SetBusSend(System.Int32, Electron2D.StringName)(System.Int32 busIdx, Electron2D.StringName send)Changes the target bus that receives a user bus output.
User buses may only send to an existing bus on their left. This keeps the
routing graph acyclic. Master accepts only an empty send target.
-
busIdx: The bus index to route. -
send: The target bus name, or an empty value to useMasterfor user buses.
-
System.ArgumentException: Thrown whensendnames no existing bus. -
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus. -
System.InvalidOperationException: Thrown when the requested route would point fromMasterto another bus, to the same bus, or to a bus on the right.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusSend(System.Int32)
Kind: Method
public static System.Void SetBusSolo(System.Int32, System.Boolean)(System.Int32 busIdx, System.Boolean enable)Enables or disables solo for a bus.
When any bus is solo, voices are audible only if their routing path contains at least one solo bus. The change applies to voices started after the state change.
-
busIdx: The bus index to change. -
enable:trueto solo the bus; otherwisefalse.
-
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.IsBusSolo(System.Int32)Electron2D.AudioServer.SetBusMute(System.Int32,System.Boolean)
Kind: Method
public static System.Void SetBusVolumeDb(System.Int32, System.Single)(System.Int32 busIdx, System.Single volumeDb)Sets a bus volume offset in decibels.
The value is added to the voice volume and to every other bus volume on
the routing path. Setting volume on Master changes the global
output level for future voices.
-
busIdx: The bus index to change. -
volumeDb: The finite decibel offset.
-
System.ArgumentException: Thrown whenvolumeDbis not finite. -
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusVolumeDb(System.Int32)Electron2D.AudioServer.SetBusVolumeLinear(System.Int32,System.Single)
Kind: Method
public static System.Void SetBusVolumeLinear(System.Int32, System.Single)(System.Int32 busIdx, System.Single volumeLinear)Sets a bus volume as linear gain.
A value of 1 maps to 0 dB. A value of 0 maps to the
preview quiet floor used for deterministic runtime tests.
-
busIdx: The bus index to change. -
volumeLinear: A finite non-negative linear gain.
-
System.ArgumentException: Thrown whenvolumeLinearis not finite. -
System.ArgumentOutOfRangeException: Thrown whenbusIdxdoes not identify an existing bus or whenvolumeLinearis negative.
This method is safe to call from any thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusVolumeLinear(System.Int32)Electron2D.AudioServer.SetBusVolumeDb(System.Int32,System.Single)
Kind: Method
public static System.Void Unlock()()Unlocks the audio server after a grouped audio change.
Call this method once for every successful Electron2D.AudioServer.Lock call.
Calling it without owning the audio server lock is an error.
This method must be called from the same thread that called
Electron2D.AudioServer.Lock.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.Lock
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.