-
Notifications
You must be signed in to change notification settings - Fork 0
AudioStreamPlayer2D
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.AudioStreamPlayer2D |
| Namespace | Electron2D |
| Kind | class |
| Category | Audio |
Plays an Electron2D.AudioStream as a sound source in 2D space.
public class Electron2D.AudioStreamPlayer2D : Electron2D.Node2DProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: AudioStreamPlayer2D
2D playback node with the shared playback API plus bus selection, distance attenuation and left/right panning.
Electron2D.AudioStreamPlayer2D uses the node's Electron2D.Node2D.GlobalPosition
to calculate distance attenuation and stereo panning before starting an
internal voice.
Electron2D 0.1.0 Preview uses the origin of the 2D world as the listener position. Dedicated listener nodes and area-based routing are future audio tasks.
This type is not synchronized. Create and mutate it on the main scene thread that owns the node.
This class is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamElectron2D.AudioStreamPlayerElectron2D.Node2D
| Member | Kind | Summary |
|---|---|---|
AreaMask |
Property | Gets or sets which 2D area layers may affect this audio source. |
Attenuation |
Property | Gets or sets the distance attenuation exponent. |
Autoplay |
Property | Gets or sets whether this node starts playback when it enters a scene tree. |
Bus |
Property | Gets or sets the target audio bus name. |
MaxDistance |
Property | Gets or sets the maximum distance from which this source is still audible. |
MaxPolyphony |
Property | Gets or sets the maximum number of simultaneous voices owned by this node. |
PanningStrength |
Property | Gets or sets the strength of left/right panning. |
PitchScale |
Property | Gets or sets the playback pitch scale. |
Playing |
Property | Gets or sets whether this player is currently requested to play. |
Stream |
Property | Gets or sets the stream resource played by this node. |
StreamPaused |
Property | Gets or sets whether playback is paused. |
VolumeDb |
Property | Gets or sets the playback volume in decibels before 2D attenuation. |
VolumeLinear |
Property | Gets or sets the playback volume as linear gain before 2D attenuation. |
Electron2D.AudioStreamPlayer2D() |
Constructor | Initializes a new instance of the Electron2D.AudioStreamPlayer2D class. |
GetPlaybackPosition() |
Method | Gets the stored playback position. |
HasStreamPlayback() |
Method | Checks whether this player currently owns an active stream voice. |
Play(System.Single) |
Method | Starts playback from a position in the stream. |
Seek(System.Single) |
Method | Changes the stored playback position. |
Stop() |
Method | Stops all voices owned by this player. |
Kind: Property
public System.Int32 AreaMask { get; set; }Gets or sets which 2D area layers may affect this audio source.
Area-based audio routing is not active in 0.1.0 Preview. The value is stored for scene data compatibility with the selected public API subset.
A non-negative bit mask. The default value is 0.
-
System.ArgumentOutOfRangeException: Thrown when the value is negative.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D
Kind: Property
public System.Single Attenuation { get; set; }Gets or sets the distance attenuation exponent.
Higher values make the sound fade faster as distance approaches
Electron2D.AudioStreamPlayer2D.MaxDistance.
A finite non-negative exponent. The default value is 1.
-
System.ArgumentException: Thrown when the value is not finite. -
System.ArgumentOutOfRangeException: Thrown when the value is negative.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.MaxDistance
Kind: Property
public System.Boolean Autoplay { get; set; }Gets or sets whether this node starts playback when it enters a scene tree.
Autoplay only starts when Electron2D.AudioStreamPlayer2D.Stream is assigned. Removing the
node from the tree stops voices owned by this player.
true to call Electron2D.AudioStreamPlayer2D.Play(System.Single) on enter-tree; otherwise
false.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Play(System.Single)
Kind: Property
public Electron2D.StringName Bus { get; set; }Gets or sets the target audio bus name.
Electron2D.AudioServer resolves this name when playback starts. If
the name does not match an existing bus, the voice falls back to
Master.
The requested bus name. The default value is Master.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioServer.GetBusName(System.Int32)Electron2D.AudioServer.SetBusName(System.Int32,System.String)Electron2D.AudioServer.SetBusSend(System.Int32,Electron2D.StringName)
Kind: Property
public System.Single MaxDistance { get; set; }Gets or sets the maximum distance from which this source is still audible.
A value of 0 disables distance attenuation and panning for this
preview implementation.
A finite non-negative distance in 2D units. The default value is
2000.
-
System.ArgumentException: Thrown when the value is not finite. -
System.ArgumentOutOfRangeException: Thrown when the value is negative.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.AttenuationElectron2D.AudioStreamPlayer2D.PanningStrength
Kind: Property
public System.Int32 MaxPolyphony { get; set; }Gets or sets the maximum number of simultaneous voices owned by this node.
When the limit is reached, the next Electron2D.AudioStreamPlayer2D.Play(System.Single) call stops
the oldest voice owned by this player before starting a new one.
The maximum polyphony count. The default value is 1.
-
System.ArgumentOutOfRangeException: Thrown when the value is less than1.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Play(System.Single)
Kind: Property
public System.Single PanningStrength { get; set; }Gets or sets the strength of left/right panning.
The computed pan is clamped to -1 through 1 before being
sent to the internal voice.
A finite non-negative panning multiplier. The default value is 1.
-
System.ArgumentException: Thrown when the value is not finite. -
System.ArgumentOutOfRangeException: Thrown when the value is negative.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.MaxDistance
Kind: Property
public System.Single PitchScale { get; set; }Gets or sets the playback pitch scale.
A value of 1 plays the stream at its original pitch.
A positive finite multiplier applied to stream pitch and tempo.
-
System.ArgumentException: Thrown when the value is not finite. -
System.ArgumentOutOfRangeException: Thrown when the value is less than or equal to0.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.VolumeDb
Kind: Property
public System.Boolean Playing { get; set; }Gets or sets whether this player is currently requested to play.
Setting this property to true calls Electron2D.AudioStreamPlayer2D.Play(System.Single).
Setting it to false calls Electron2D.AudioStreamPlayer2D.Stop.
true when playback is active or paused; otherwise false.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.StreamPaused
Kind: Property
public Electron2D.AudioStream Stream { get; set; }Gets or sets the stream resource played by this node.
Setting this property stops all voices currently owned by this player.
The stream resource to play, or null when no stream is assigned.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Play(System.Single)
Kind: Property
public System.Boolean StreamPaused { get; set; }Gets or sets whether playback is paused.
Pausing stops active voices but keeps Electron2D.AudioStreamPlayer2D.Playing true.
Clearing this property resumes from the stored playback position when a
stream is assigned.
true when playback should pause and resume later; otherwise
false.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Playing
Kind: Property
public System.Single VolumeDb { get; set; }Gets or sets the playback volume in decibels before 2D attenuation.
The value is combined with distance attenuation when Electron2D.AudioStreamPlayer2D.Play(System.Single)
starts a voice.
A finite decibel offset applied to the stream.
-
System.ArgumentException: Thrown when the value is not finite.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.VolumeLinear
Kind: Property
public System.Single VolumeLinear { get; set; }Gets or sets the playback volume as linear gain before 2D attenuation.
Setting this property updates Electron2D.AudioStreamPlayer2D.VolumeDb.
A finite non-negative linear gain. The default value is 1.
-
System.ArgumentException: Thrown when the value is not finite. -
System.ArgumentOutOfRangeException: Thrown when the value is negative.
This property is not synchronized. Access it from the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.VolumeDb
Kind: Constructor
public Electron2D.AudioStreamPlayer2D()Initializes a new instance of the Electron2D.AudioStreamPlayer2D class.
The new player has no stream assigned, targets the Master bus and
registers the finished signal.
This constructor is not synchronized. Call it from the main scene thread.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Stream
Kind: Method
public System.Single GetPlaybackPosition()()Gets the stored playback position.
The preview runtime stores the last requested start or seek position. It does not expose backend clock advancement as public API.
The stored playback position in seconds.
This method is not synchronized. Call it from the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Seek(System.Single)
Kind: Method
public System.Boolean HasStreamPlayback()()Checks whether this player currently owns an active stream voice.
This method returns false while Electron2D.AudioStreamPlayer2D.StreamPaused is
true.
true when at least one internal voice owned by this player is
active; otherwise false.
This method is not synchronized. Call it from the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Playing
Kind: Method
public System.Void Play(System.Single)(System.Single fromPosition)Starts playback from a position in the stream.
Calling this method creates a new 2D voice when Electron2D.AudioStreamPlayer2D.Stream is
assigned. The voice receives volume attenuation and pan calculated from
the node position.
-
fromPosition: The stream position, in seconds, where playback should begin.
-
System.ArgumentException: Thrown whenfromPositionis not finite. -
System.ArgumentOutOfRangeException: Thrown whenfromPositionis negative.
This method is not synchronized. Call it from the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Seek(System.Single)Electron2D.AudioStreamPlayer2D.Stop
Kind: Method
public System.Void Seek(System.Single)(System.Single toPosition)Changes the stored playback position.
If playback is active and not paused, this method restarts the active
voice from toPosition.
-
toPosition: The stream position, in seconds, to seek to.
-
System.ArgumentException: Thrown whentoPositionis not finite. -
System.ArgumentOutOfRangeException: Thrown whentoPositionis negative.
This method is not synchronized. Call it from the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.GetPlaybackPosition
Kind: Method
public System.Void Stop()()Stops all voices owned by this player.
The stored playback position is reset to 0. Calling
Electron2D.AudioStreamPlayer2D.Stop does not emit the finished signal.
This method is not synchronized. Call it from the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AudioStreamPlayer2D.Play(System.Single)
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.