Documentation
¶
Overview ¶
Plays audio that is attenuated with distance to the listener.
By default, audio is heard from the screen center. This can be changed by adding an graphics.gd/classdb/AudioListener2D node to the scene and enabling it by calling graphics.gd/classdb/AudioListener2D.Instance.MakeCurrent on it.
See also graphics.gd/classdb/AudioStreamPlayer to play a sound non-positionally.
Note: Hiding an graphics.gd/classdb/AudioStreamPlayer2D node does not disable its audio output. To temporarily disable an graphics.gd/classdb/AudioStreamPlayer2D's audio output, set Instance.VolumeDb to a very low value like -100 (which isn't audible to human hearing).
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AreaMask() int
- func (self Instance) AsAudioStreamPlayer2D() Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Node2D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) Attenuation() Float.X
- func (self Instance) Autoplay() bool
- func (self Instance) Bus() string
- func (self Instance) GetPlaybackPosition() Float.X
- func (self Instance) GetStreamPlayback() AudioStreamPlayback.Instance
- func (self Instance) HasStreamPlayback() bool
- func (self Instance) ID() ID
- func (self Instance) MaxDistance() Float.X
- func (self Instance) MaxPolyphony() int
- func (self Instance) OnFinished(cb func(), flags ...Signal.Flags)
- func (self Instance) PanningStrength() Float.X
- func (self Instance) PitchScale() Float.X
- func (self Instance) Play()
- func (self Instance) PlaybackType() AudioServer.PlaybackType
- func (self Instance) Playing() bool
- func (self Instance) SeekTo(to_position Float.X)
- func (self Instance) SetAreaMask(value int)
- func (self Instance) SetAttenuation(value Float.X)
- func (self Instance) SetAutoplay(value bool)
- func (self Instance) SetBus(value string)
- func (self Instance) SetMaxDistance(value Float.X)
- func (self Instance) SetMaxPolyphony(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPanningStrength(value Float.X)
- func (self Instance) SetPitchScale(value Float.X)
- func (self Instance) SetPlaybackType(value AudioServer.PlaybackType)
- func (self Instance) SetPlaying(value bool)
- func (self Instance) SetStream(value AudioStream.Instance)
- func (self Instance) SetStreamPaused(value bool)
- func (self Instance) SetVolumeDb(value Float.X)
- func (self Instance) SetVolumeLinear(value Float.X)
- func (self Instance) Stop()
- func (self Instance) Stream() AudioStream.Instance
- func (self Instance) StreamPaused() bool
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VolumeDb() Float.X
- func (self Instance) VolumeLinear() Float.X
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
type Expanded [1]gdclass.AudioStreamPlayer2D
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
func (*Extension[T]) AsAudioStreamPlayer2D ¶
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
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.AudioStreamPlayer2D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsAudioStreamPlayer2D ¶
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) Attenuation ¶
func (Instance) GetPlaybackPosition ¶
Returns the position in the graphics.gd/classdb/AudioStream.
func (Instance) GetStreamPlayback ¶
func (self Instance) GetStreamPlayback() AudioStreamPlayback.Instance
Returns the graphics.gd/classdb/AudioStreamPlayback object associated with this graphics.gd/classdb/AudioStreamPlayer2D.
func (Instance) HasStreamPlayback ¶
Returns whether the graphics.gd/classdb/AudioStreamPlayer can return the graphics.gd/classdb/AudioStreamPlayback object or not.
func (Instance) MaxDistance ¶
func (Instance) MaxPolyphony ¶
func (Instance) OnFinished ¶
func (Instance) PanningStrength ¶
func (Instance) PitchScale ¶
func (Instance) Play ¶
func (self Instance) Play()
Queues the audio to play on the next physics frame, from the given position 'from_position', in seconds.
func (Instance) PlaybackType ¶
func (self Instance) PlaybackType() AudioServer.PlaybackType
func (Instance) SetAreaMask ¶
func (Instance) SetAttenuation ¶
func (Instance) SetAutoplay ¶
func (Instance) SetMaxDistance ¶
func (Instance) SetMaxPolyphony ¶
func (Instance) SetPanningStrength ¶
func (Instance) SetPitchScale ¶
func (Instance) SetPlaybackType ¶
func (self Instance) SetPlaybackType(value AudioServer.PlaybackType)
func (Instance) SetPlaying ¶
func (Instance) SetStream ¶
func (self Instance) SetStream(value AudioStream.Instance)
func (Instance) SetStreamPaused ¶
func (Instance) SetVolumeDb ¶
func (Instance) SetVolumeLinear ¶
func (Instance) Stream ¶
func (self Instance) Stream() AudioStream.Instance