AudioStreamPlayer3D
Hereda: Node3D < Node < Object
Plays positional sound in 3D space.
Descripción
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 attenuation_filter_cutoff_hz to 20500.
By default, audio is heard from the camera position. This can be changed by adding an AudioListener3D node to the scene and enabling it by calling AudioListener3D.make_current() 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 volume_db to a very low value like -100 (which isn't audible to human hearing).
Tutoriales
Propiedades
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Métodos
void |
|
void |
|
void |
stop() |
Señales
finished() 🔗
Emitida cuando el audio deja de reproducirse.
Enumeraciones
enum AttenuationModel: 🔗
AttenuationModel ATTENUATION_INVERSE_DISTANCE = 0
Atenuación de la sonoridad según la distancia lineal.
AttenuationModel ATTENUATION_INVERSE_SQUARE_DISTANCE = 1
Atenuación de la sonoridad según la distancia al cuadrado.
AttenuationModel ATTENUATION_LOGARITHMIC = 2
Atenuación de la sonoridad según la distancia logarítmica.
AttenuationModel ATTENUATION_DISABLED = 3
Sin atenuación de la sonoridad según la distancia. El sonido seguirá oyéndose posicionalmente, a diferencia de un AudioStreamPlayer. ATTENUATION_DISABLED se puede combinar con un valor de max_distance mayor que 0.0 para lograr una atenuación lineal sujeta a una esfera de un tamaño definido.
enum DopplerTracking: 🔗
DopplerTracking DOPPLER_TRACKING_DISABLED = 0
Desactiva el rastreo doppler.
DopplerTracking DOPPLER_TRACKING_IDLE_STEP = 1
Ejecuta el seguimiento Doppler durante los fotogramas del proceso (véase Node.NOTIFICATION_INTERNAL_PROCESS).
DopplerTracking DOPPLER_TRACKING_PHYSICS_STEP = 2
Ejecuta el seguimiento Doppler durante los fotogramas de la física (véase Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS).
Descripciones de Propiedades
Determines which Area3D layers affect the sound for reverb and audio bus effects. Areas can be used to redirect AudioStreams so that they play in a certain audio bus. An example of how you might use this is making a "water" area so that sounds played in the water are redirected through an audio bus to make them sound like they are being played underwater.
float attenuation_filter_cutoff_hz = 5000.0 🔗
The cutoff frequency of the attenuation low-pass filter, in Hz. A sound above this frequency is attenuated more than a sound below this frequency. To disable this effect, set this to 20500 as this frequency is above the human hearing limit.
float attenuation_filter_db = -24.0 🔗
Amount how much the filter affects the loudness, in decibels.
AttenuationModel attenuation_model = 0 🔗
void set_attenuation_model(value: AttenuationModel)
AttenuationModel get_attenuation_model()
Decide si el audio debe ser más silencioso con la distancia lineal, cuadrática, logarítmica, o no ser afectado por la distancia, desactivando efectivamente la atenuación.
If true, audio plays when the AudioStreamPlayer3D node is added to scene tree.
StringName bus = &"Master" 🔗
void set_bus(value: StringName)
StringName get_bus()
The bus on which this audio is playing.
Note: When setting this property, keep in mind that no validation is performed to see if the given name matches an existing bus. This is because audio bus layouts might be loaded after this property is set. If this given name can't be resolved at runtime, it will fall back to "Master".
DopplerTracking doppler_tracking = 0 🔗
void set_doppler_tracking(value: DopplerTracking)
DopplerTracking get_doppler_tracking()
Decides in which step the Doppler effect should be calculated.
Note: If doppler_tracking is not DOPPLER_TRACKING_DISABLED but the current Camera3D/AudioListener3D has doppler tracking disabled, the Doppler effect will be heard but will not take the movement of the current listener into account. If accurate Doppler effect is desired, doppler tracking should be enabled on both the AudioStreamPlayer3D and the current Camera3D/AudioListener3D.
float emission_angle_degrees = 45.0 🔗
El ángulo en el que el audio llega a un oyente sin atenuarse.
bool emission_angle_enabled = false 🔗
Si es true, el audio debe atenuarse según la dirección del sonido.
float emission_angle_filter_attenuation_db = -12.0 🔗
void set_emission_angle_filter_attenuation_db(value: float)
float get_emission_angle_filter_attenuation_db()
Factor de atenuación utilizado si el oyente está fuera de emission_angle_degrees y emission_angle_enabled está habilitado, en decibelios.
Establece el máximo absoluto del nivel de sonido, en decibelios.
La distancia a partir de la cual el sonido ya no se puede escuchar en absoluto. Solo tiene efecto si se establece a un valor mayor que 0.0. max_distance funciona en conjunto con unit_size. Sin embargo, a diferencia de unit_size cuyo comportamiento depende del attenuation_model, max_distance siempre funciona de forma lineal. Esto se puede usar para evitar que el AudioStreamPlayer3D requiera mezcla de audio cuando el oyente está lejos, lo que ahorra recursos de la CPU.
The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.
float panning_strength = 1.0 🔗
Escala la fuerza de paneo para este nodo multiplicando la base ProjectSettings.audio/general/3d_panning_strength por este factor. Si el producto es 0.0, entonces el paneo estéreo está desactivado y el volumen es el mismo para todos los canales. Si el producto es 1.0, entonces uno de los canales se silenciará cuando el sonido se encuentre exactamente a la izquierda (o a la derecha) del oyente.
Las disposiciones estéreo de dos altavoces implementan el Estándar WebAudio para StereoPannerNode Panning donde el volumen es el coseno de la mitad del ángulo de acimut al oído.
Para otras disposiciones de altavoces, como el 5.1 y el 7.1, se implementa el algoritmo SPCAP (Speaker-Placement Correction Amplitude).
El tono y el tempo del audio, como multiplicador de la tasa de muestreo de la muestra de audio.
PlaybackType playback_type = 0 🔗
void set_playback_type(value: PlaybackType)
PlaybackType get_playback_type()
Experimental: Esta propiedad podría ser modificada o eliminada en versiones futuras.
The playback type of the stream player. If set other than to the default value, it will force that playback type.
If true, audio is playing or is queued to be played (see play()).
AudioStream stream 🔗
void set_stream(value: AudioStream)
AudioStream get_stream()
The AudioStream resource to be played.
If true, the playback is paused. You can resume it by setting stream_paused to false.
El factor para el efecto de atenuación. Valores más altos hacen que el sonido sea escuchado a mayor distancia.
El nivel de sonido base antes de la atenuación, en decibelios.
El nivel de sonido base antes de la atenuación, como un valor lineal.
Nota: Este miembro modifica volume_db para mayor comodidad. El valor devuelto es equivalente al resultado de @GlobalScope.db_to_linear() en volume_db. Establecer este miembro es equivalente a establecer volume_db al resultado de @GlobalScope.linear_to_db() en un valor.
Descripciones de Métodos
float get_playback_position() 🔗
Devuelve la posición en el AudioStream.
AudioStreamPlayback get_stream_playback() 🔗
Devuelve el objeto AudioStreamPlayback asociado a este AudioStreamPlayer3D.
Returns whether the AudioStreamPlayer can return the AudioStreamPlayback object or not.
void play(from_position: float = 0.0) 🔗
Queues the audio to play on the next physics frame, from the given position from_position, in seconds.
void seek(to_position: float) 🔗
Establece la posición desde la que se reproducirá el audio, en segundos.
void stop() 🔗
Detiene el audio.