Documentation
¶
Overview ¶
Plays audio with positional sound effects, based on the relative position of the audio listener. Positional effects include distance attenuation, directionality, and the Doppler effect. For greater realism, a low-pass filter is applied to distant sounds. This can be disabled by setting Instance.AttenuationFilterCutoffHz to 20500.
By default, audio is heard from the camera position. This can be changed by adding an graphics.gd/classdb/AudioListener3D node to the scene and enabling it by calling graphics.gd/classdb/AudioListener3D.Instance.MakeCurrent on it.
See also graphics.gd/classdb/AudioStreamPlayer to play a sound non-positionally.
Note: Hiding an graphics.gd/classdb/AudioStreamPlayer3D node does not disable its audio output. To temporarily disable an graphics.gd/classdb/AudioStreamPlayer3D'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 AttenuationModel
- type DopplerTracking
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AreaMask() int
- func (self Instance) AsAudioStreamPlayer3D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AttenuationFilterCutoffHz() Float.X
- func (self Instance) AttenuationFilterDb() Float.X
- func (self Instance) AttenuationModel() AttenuationModel
- func (self Instance) Autoplay() bool
- func (self Instance) Bus() string
- func (self Instance) DopplerTracking() DopplerTracking
- func (self Instance) EmissionAngleDegrees() Angle.Radians
- func (self Instance) EmissionAngleEnabled() bool
- func (self Instance) EmissionAngleFilterAttenuationDb() Angle.Radians
- 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) MaxDb() Float.X
- 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) SetAttenuationFilterCutoffHz(value Float.X)
- func (self Instance) SetAttenuationFilterDb(value Float.X)
- func (self Instance) SetAttenuationModel(value AttenuationModel)
- func (self Instance) SetAutoplay(value bool)
- func (self Instance) SetBus(value string)
- func (self Instance) SetDopplerTracking(value DopplerTracking)
- func (self Instance) SetEmissionAngleDegrees(value Angle.Radians)
- func (self Instance) SetEmissionAngleEnabled(value bool)
- func (self Instance) SetEmissionAngleFilterAttenuationDb(value Angle.Radians)
- func (self Instance) SetMaxDb(value Float.X)
- 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) SetUnitSize(value Float.X)
- 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) UnitSize() Float.X
- 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 AttenuationModel ¶
type AttenuationModel int //gd:AudioStreamPlayer3D.AttenuationModel
const ( // Attenuation of loudness according to linear distance. AttenuationInverseDistance AttenuationModel = 0 // Attenuation of loudness according to squared distance. AttenuationInverseSquareDistance AttenuationModel = 1 // Attenuation of loudness according to logarithmic distance. AttenuationLogarithmic AttenuationModel = 2 // No attenuation of loudness according to distance. The sound will still be heard positionally, unlike an [graphics.gd/classdb/AudioStreamPlayer]. [AttenuationDisabled] can be combined with a [Instance.MaxDistance] value greater than 0.0 to achieve linear attenuation clamped to a sphere of a defined size. AttenuationDisabled AttenuationModel = 3 )
type DopplerTracking ¶
type DopplerTracking int //gd:AudioStreamPlayer3D.DopplerTracking
const ( // Disables doppler tracking. DopplerTrackingDisabled DopplerTracking = 0 // Executes doppler tracking during process frames (see [Node.NotificationInternalProcess]). DopplerTrackingIdleStep DopplerTracking = 1 // Executes doppler tracking during physics frames (see [Node.NotificationInternalPhysicsProcess]). DopplerTrackingPhysicsStep DopplerTracking = 2 )
type Expanded ¶
type Expanded [1]gdclass.AudioStreamPlayer3D
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]) AsAudioStreamPlayer3D ¶
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.AudioStreamPlayer3D
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) AsAudioStreamPlayer3D ¶
func (Instance) AttenuationFilterCutoffHz ¶
func (Instance) AttenuationFilterDb ¶
func (Instance) AttenuationModel ¶
func (self Instance) AttenuationModel() AttenuationModel
func (Instance) DopplerTracking ¶
func (self Instance) DopplerTracking() DopplerTracking
func (Instance) EmissionAngleDegrees ¶
func (Instance) EmissionAngleEnabled ¶
func (Instance) EmissionAngleFilterAttenuationDb ¶
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/AudioStreamPlayer3D.
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) SetAttenuationFilterCutoffHz ¶
func (Instance) SetAttenuationFilterDb ¶
func (Instance) SetAttenuationModel ¶
func (self Instance) SetAttenuationModel(value AttenuationModel)
func (Instance) SetAutoplay ¶
func (Instance) SetDopplerTracking ¶
func (self Instance) SetDopplerTracking(value DopplerTracking)
func (Instance) SetEmissionAngleDegrees ¶
func (Instance) SetEmissionAngleEnabled ¶
func (Instance) SetEmissionAngleFilterAttenuationDb ¶
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) SetUnitSize ¶
func (Instance) SetVolumeDb ¶
func (Instance) SetVolumeLinear ¶
func (Instance) Stream ¶
func (self Instance) Stream() AudioStream.Instance