AudioStreamPlayer3D

Plays positional sound in 3D space.

Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. For greater realism, a low-pass filter is automatically applied to distant sounds. This can be disabled by setting attenuationFilterCutoffHz to 20500. By default, audio is heard from the camera position. This can be changed by adding a Listener node to the scene and enabling it by calling Listener.makeCurrent on it. See also AudioStreamPlayer to play a sound non-positionally. Note: Hiding an AudioStreamPlayer3D node does not disable its audio output. To temporarily disable an AudioStreamPlayer3D's audio output, set unitDb to a very low value like -100 (which isn't audible to human hearing).

@GodotBaseClass
struct AudioStreamPlayer3D {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

AttenuationModel
enum AttenuationModel
Constants
enum Constants
DopplerTracking
enum DopplerTracking
OutOfRangeMode
enum OutOfRangeMode

Functions

_busLayoutChanged
void _busLayoutChanged()
_isActive
bool _isActive()
_setPlaying
void _setPlaying(bool enable)
getAreaMask
long getAreaMask()
getAttenuationFilterCutoffHz
double getAttenuationFilterCutoffHz()
getAttenuationFilterDb
double getAttenuationFilterDb()
getAttenuationModel
AudioStreamPlayer3D.AttenuationModel getAttenuationModel()
getBus
String getBus()
getDopplerTracking
AudioStreamPlayer3D.DopplerTracking getDopplerTracking()
getEmissionAngle
double getEmissionAngle()
getEmissionAngleFilterAttenuationDb
double getEmissionAngleFilterAttenuationDb()
getMaxDb
double getMaxDb()
getMaxDistance
double getMaxDistance()
getOutOfRangeMode
AudioStreamPlayer3D.OutOfRangeMode getOutOfRangeMode()
getPitchScale
double getPitchScale()
getPlaybackPosition
double getPlaybackPosition()

Returns the position in the AudioStream.

getStream
Ref!AudioStream getStream()
getStreamPaused
bool getStreamPaused()
getStreamPlayback
Ref!AudioStreamPlayback getStreamPlayback()

Returns the AudioStreamPlayback object associated with this AudioStreamPlayer3D.

getUnitDb
double getUnitDb()
getUnitSize
double getUnitSize()
isAutoplayEnabled
bool isAutoplayEnabled()
isEmissionAngleEnabled
bool isEmissionAngleEnabled()
isPlaying
bool isPlaying()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(AudioStreamPlayer3D other)
opEquals
bool opEquals(typeof(null) n)
play
void play(double from_position)

Plays the audio from the given position from_position, in seconds.

seek
void seek(double to_position)

Sets the position from which audio will be played, in seconds.

setAreaMask
void setAreaMask(long mask)
setAttenuationFilterCutoffHz
void setAttenuationFilterCutoffHz(double degrees)
setAttenuationFilterDb
void setAttenuationFilterDb(double db)
setAttenuationModel
void setAttenuationModel(long model)
setAutoplay
void setAutoplay(bool enable)
setBus
void setBus(String bus)
setDopplerTracking
void setDopplerTracking(long mode)
setEmissionAngle
void setEmissionAngle(double degrees)
setEmissionAngleEnabled
void setEmissionAngleEnabled(bool enabled)
setEmissionAngleFilterAttenuationDb
void setEmissionAngleFilterAttenuationDb(double db)
setMaxDb
void setMaxDb(double max_db)
setMaxDistance
void setMaxDistance(double metres)
setOutOfRangeMode
void setOutOfRangeMode(long mode)
setPitchScale
void setPitchScale(double pitch_scale)
setStream
void setStream(AudioStream stream)
setStreamPaused
void setStreamPaused(bool pause)
setUnitDb
void setUnitDb(double unit_db)
setUnitSize
void setUnitSize(double unit_size)
stop
void stop()

Stops the audio.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

areaMask
long areaMask [@property getter]
long areaMask [@property setter]

Areas in which this sound plays.

attenuationFilterCutoffHz
double attenuationFilterCutoffHz [@property getter]
double attenuationFilterCutoffHz [@property setter]

Dampens audio using a low-pass filter above this frequency, in Hz. To disable the dampening effect entirely, set this to 20500 as this frequency is above the human hearing limit.

attenuationFilterDb
double attenuationFilterDb [@property getter]
double attenuationFilterDb [@property setter]

Amount how much the filter affects the loudness, in decibels.

attenuationModel
AudioStreamPlayer3D.AttenuationModel attenuationModel [@property getter]
long attenuationModel [@property setter]

Decides if audio should get quieter with distance linearly, quadratically, logarithmically, or not be affected by distance, effectively disabling attenuation.

autoplay
bool autoplay [@property getter]
bool autoplay [@property setter]

If true, audio plays when the AudioStreamPlayer3D node is added to scene tree.

bus
String bus [@property getter]
String bus [@property setter]

The bus on which this audio is playing.

dopplerTracking
AudioStreamPlayer3D.DopplerTracking dopplerTracking [@property getter]
long dopplerTracking [@property setter]

Decides in which step the Doppler effect should be calculated.

emissionAngleDegrees
double emissionAngleDegrees [@property getter]
double emissionAngleDegrees [@property setter]

The angle in which the audio reaches cameras undampened.

emissionAngleEnabled
bool emissionAngleEnabled [@property getter]
bool emissionAngleEnabled [@property setter]

If true, the audio should be dampened according to the direction of the sound.

emissionAngleFilterAttenuationDb
double emissionAngleFilterAttenuationDb [@property getter]
double emissionAngleFilterAttenuationDb [@property setter]

Dampens audio if camera is outside of emissionAngleDegrees and emissionAngleEnabled is set by this factor, in decibels.

maxDb
double maxDb [@property getter]
double maxDb [@property setter]

Sets the absolute maximum of the soundlevel, in decibels.

maxDistance
double maxDistance [@property getter]
double maxDistance [@property setter]

Sets the distance from which the outOfRangeMode takes effect. Has no effect if set to 0.

outOfRangeMode
AudioStreamPlayer3D.OutOfRangeMode outOfRangeMode [@property getter]
long outOfRangeMode [@property setter]

Decides if audio should pause when source is outside of maxDistance range.

pitchScale
double pitchScale [@property getter]
double pitchScale [@property setter]

The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate.

playing
bool playing [@property getter]
bool playing [@property setter]

If true, audio is playing.

stream
AudioStream stream [@property getter]
AudioStream stream [@property setter]

The AudioStream resource to be played.

streamPaused
bool streamPaused [@property getter]
bool streamPaused [@property setter]

If true, the playback is paused. You can resume it by setting streamPaused to false.

unitDb
double unitDb [@property getter]
double unitDb [@property setter]

The base sound level unaffected by dampening, in decibels.

unitSize
double unitSize [@property getter]
double unitSize [@property setter]

The factor for the attenuation effect. Higher values make the sound audible over a larger distance.

Static functions

_new
AudioStreamPlayer3D _new()

Construct a new instance of AudioStreamPlayer3D. Note: use memnew!AudioStreamPlayer3D instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta