AudioStreamRandomizer

Hereda: AudioStream < Resource < RefCounted < Object

Envuelve un grupo de transmisiones de audio con cambio de tono y volumen.

Descripción

Elige un AudioStream aleatorio del grupo, dependiendo del modo de reproducción, y aplica cambios aleatorios de tono y volumen durante la reproducción.

Propiedades

PlaybackMode

playback_mode

0

float

random_pitch

1.0

float

random_pitch_semitones

0.0

float

random_volume_offset_db

0.0

int

streams_count

0

Métodos

void

add_stream(index: int, stream: AudioStream, weight: float = 1.0)

AudioStream

get_stream(index: int) const

float

get_stream_probability_weight(index: int) const

void

move_stream(index_from: int, index_to: int)

void

remove_stream(index: int)

void

set_stream(index: int, stream: AudioStream)

void

set_stream_probability_weight(index: int, weight: float)


Enumeraciones

enum PlaybackMode: 🔗

PlaybackMode PLAYBACK_RANDOM_NO_REPEATS = 0

Pick a stream at random according to the probability weights chosen for each stream, but avoid playing the same stream twice in a row whenever possible. If only 1 sound is present in the pool, the same sound will always play, effectively allowing repeats to occur.

PlaybackMode PLAYBACK_RANDOM = 1

Pick a stream at random according to the probability weights chosen for each stream. If only 1 sound is present in the pool, the same sound will always play.

PlaybackMode PLAYBACK_SEQUENTIAL = 2

Play streams in the order they appear in the stream pool. If only 1 sound is present in the pool, the same sound will always play.


Descripciones de Propiedades

PlaybackMode playback_mode = 0 🔗

Controla cómo este AudioStreamRandomizer elige qué AudioStream reproducir a continuación.


float random_pitch = 1.0 🔗

  • void set_random_pitch(value: float)

  • float get_random_pitch()

El mayor multiplicador de frecuencia posible de la variación de tono aleatoria. El tono se elegirá aleatoriamente dentro de un rango de 1.0 / random_pitch y random_pitch. Un valor de 1.0 significa que no hay variación. Un valor de 2.0 significa que el tono se aleatorizará entre el doble y la mitad.

Nota: Establecer esta propiedad también establece random_pitch_semitones.


float random_pitch_semitones = 0.0 🔗

  • void set_random_pitch_semitones(value: float)

  • float get_random_pitch_semitones()

La mayor distancia posible, en semitonos, de la variación de tono aleatoria. Un valor de 0.0 significa que no hay variación.

Nota: Establecer esta propiedad también establece random_pitch.


float random_volume_offset_db = 0.0 🔗

  • void set_random_volume_offset_db(value: float)

  • float get_random_volume_offset_db()

La intensidad de la variación de volumen aleatoria. El volumen se aumentará o disminuirá en un valor aleatorio hasta random_volume_offset_db. Un valor de 0.0 significa que no hay variación. Un valor de 3.0 significa que el volumen se aleatorizará entre -3.0 dB y +3.0 dB.


int streams_count = 0 🔗

  • void set_streams_count(value: int)

  • int get_streams_count()

The number of streams in the stream pool.


Descripciones de Métodos

void add_stream(index: int, stream: AudioStream, weight: float = 1.0) 🔗

Inserta una transmisión en el índice especificado. Si el índice es menor que cero, la inserción se produce al final del grupo subyacente.


AudioStream get_stream(index: int) const 🔗

Devuelve la transmisión en el índice especificado.


float get_stream_probability_weight(index: int) const 🔗

Devuelve el peso de probabilidad asociado con la transmisión en el índice dado.


void move_stream(index_from: int, index_to: int) 🔗

Mueve una transmisión de un índice a otro.


void remove_stream(index: int) 🔗

Elimina la transmisión en el índice especificado.


void set_stream(index: int, stream: AudioStream) 🔗

Establece el AudioStream en el índice especificado.


void set_stream_probability_weight(index: int, weight: float) 🔗

Set the probability weight of the stream at the specified index. The higher this value, the more likely that the randomizer will choose this stream during random playback modes.