mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
294 lines
15 KiB
ReStructuredText
294 lines
15 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_AudioStreamRandomizer:
|
|
|
|
AudioStreamRandomizer
|
|
=====================
|
|
|
|
**Hereda:** :ref:`AudioStream<class_AudioStream>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Envuelve un grupo de transmisiones de audio con cambio de tono y volumen.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Propiedades
|
|
----------------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` | :ref:`playback_mode<class_AudioStreamRandomizer_property_playback_mode>` | ``0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`random_pitch<class_AudioStreamRandomizer_property_random_pitch>` | ``1.0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`random_pitch_semitones<class_AudioStreamRandomizer_property_random_pitch_semitones>` | ``0.0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`random_volume_offset_db<class_AudioStreamRandomizer_property_random_volume_offset_db>` | ``0.0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
| :ref:`int<class_int>` | :ref:`streams_count<class_AudioStreamRandomizer_property_streams_count>` | ``0`` |
|
|
+--------------------------------------------------------------+----------------------------------------------------------------------------------------------+---------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_stream<class_AudioStreamRandomizer_method_add_stream>`\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`, weight\: :ref:`float<class_float>` = 1.0\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`AudioStream<class_AudioStream>` | :ref:`get_stream<class_AudioStreamRandomizer_method_get_stream>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_stream_probability_weight<class_AudioStreamRandomizer_method_get_stream_probability_weight>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`move_stream<class_AudioStreamRandomizer_method_move_stream>`\ (\ index_from\: :ref:`int<class_int>`, index_to\: :ref:`int<class_int>`\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`remove_stream<class_AudioStreamRandomizer_method_remove_stream>`\ (\ index\: :ref:`int<class_int>`\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_stream<class_AudioStreamRandomizer_method_set_stream>`\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_stream_probability_weight<class_AudioStreamRandomizer_method_set_stream_probability_weight>`\ (\ index\: :ref:`int<class_int>`, weight\: :ref:`float<class_float>`\ ) |
|
|
+---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumeraciones
|
|
--------------------------
|
|
|
|
.. _enum_AudioStreamRandomizer_PlaybackMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **PlaybackMode**: :ref:`🔗<enum_AudioStreamRandomizer_PlaybackMode>`
|
|
|
|
.. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM_NO_REPEATS:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_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.
|
|
|
|
.. _class_AudioStreamRandomizer_constant_PLAYBACK_RANDOM:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_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.
|
|
|
|
.. _class_AudioStreamRandomizer_constant_PLAYBACK_SEQUENTIAL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_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.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descripciones de Propiedades
|
|
--------------------------------------------------------
|
|
|
|
.. _class_AudioStreamRandomizer_property_playback_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **playback_mode** = ``0`` :ref:`🔗<class_AudioStreamRandomizer_property_playback_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_playback_mode**\ (\ value\: :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>`\ )
|
|
- :ref:`PlaybackMode<enum_AudioStreamRandomizer_PlaybackMode>` **get_playback_mode**\ (\ )
|
|
|
|
Controla cómo este AudioStreamRandomizer elige qué AudioStream reproducir a continuación.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_random_pitch:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **random_pitch** = ``1.0`` :ref:`🔗<class_AudioStreamRandomizer_property_random_pitch>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_random_pitch**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_random_pitch**\ (\ )
|
|
|
|
The largest possible frequency multiplier of the random pitch variation. Pitch will be randomly chosen within a range of ``1.0 / random_pitch`` and ``random_pitch``. A value of ``1.0`` means no variation. A value of ``2.0`` means pitch will be randomized between double and half.
|
|
|
|
\ **Note:** Setting this property also sets :ref:`random_pitch_semitones<class_AudioStreamRandomizer_property_random_pitch_semitones>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_random_pitch_semitones:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **random_pitch_semitones** = ``0.0`` :ref:`🔗<class_AudioStreamRandomizer_property_random_pitch_semitones>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_random_pitch_semitones**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_random_pitch_semitones**\ (\ )
|
|
|
|
The largest possible distance, in semitones, of the random pitch variation. A value of ``0.0`` means no variation.
|
|
|
|
\ **Note:** Setting this property also sets :ref:`random_pitch<class_AudioStreamRandomizer_property_random_pitch>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_random_volume_offset_db:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **random_volume_offset_db** = ``0.0`` :ref:`🔗<class_AudioStreamRandomizer_property_random_volume_offset_db>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_random_volume_offset_db**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_random_volume_offset_db**\ (\ )
|
|
|
|
The intensity of random volume variation. Volume will be increased or decreased by a random value up to ``random_volume_offset_db``. A value of ``0.0`` means no variation. A value of ``3.0`` means volume will be randomized between ``-3.0 dB`` and ``+3.0 dB``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_property_streams_count:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **streams_count** = ``0`` :ref:`🔗<class_AudioStreamRandomizer_property_streams_count>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_streams_count**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_streams_count**\ (\ )
|
|
|
|
The number of streams in the stream pool.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_AudioStreamRandomizer_method_add_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_stream**\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`, weight\: :ref:`float<class_float>` = 1.0\ ) :ref:`🔗<class_AudioStreamRandomizer_method_add_stream>`
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_get_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`AudioStream<class_AudioStream>` **get_stream**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioStreamRandomizer_method_get_stream>`
|
|
|
|
Devuelve la transmisión en el índice especificado.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_get_stream_probability_weight:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`float<class_float>` **get_stream_probability_weight**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AudioStreamRandomizer_method_get_stream_probability_weight>`
|
|
|
|
Devuelve el peso de probabilidad asociado con la transmisión en el índice dado.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_move_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **move_stream**\ (\ index_from\: :ref:`int<class_int>`, index_to\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_move_stream>`
|
|
|
|
Mueve una transmisión de un índice a otro.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_remove_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **remove_stream**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_remove_stream>`
|
|
|
|
Elimina la transmisión en el índice especificado.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_set_stream:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_stream**\ (\ index\: :ref:`int<class_int>`, stream\: :ref:`AudioStream<class_AudioStream>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_set_stream>`
|
|
|
|
Establece el AudioStream en el índice especificado.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AudioStreamRandomizer_method_set_stream_probability_weight:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_stream_probability_weight**\ (\ index\: :ref:`int<class_int>`, weight\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AudioStreamRandomizer_method_set_stream_probability_weight>`
|
|
|
|
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.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (Normalmente, este método debería ser sobreescrito por el usuario para que tenga algún efecto.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (Este método no tiene efectos secundarios. No modifica ninguna de las variables miembro de la instancia.)`
|
|
.. |vararg| replace:: :abbr:`vararg (Este método permite agregar cualquier número de argumentos después de los descritos aquí.)`
|
|
.. |constructor| replace:: :abbr:`constructor (Este método se utiliza para construir un tipo.)`
|
|
.. |static| replace:: :abbr:`static (Este método no necesita una instancia para ser llamado, por lo que puede llamarse directamente utilizando el nombre de la clase.)`
|
|
.. |operator| replace:: :abbr:`operator (Este método describe un operador válido para usar con este tipo como operando izquierdo.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (Este valor es un entero compuesto como una máscara de bits de las siguientes banderas.)`
|
|
.. |void| replace:: :abbr:`void (Sin valor de retorno.)`
|