Files
godot-docs/classes/class_audiostreamplayer.rst
2018-12-27 11:16:05 +01:00

209 lines
7.3 KiB
ReStructuredText

.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the AudioStreamPlayer.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_AudioStreamPlayer:
AudioStreamPlayer
=================
**Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Category:** Core
Brief Description
-----------------
Plays back audio.
Properties
----------
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`autoplay<class_AudioStreamPlayer_autoplay>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`bus<class_AudioStreamPlayer_bus>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`MixTarget<enum_AudioStreamPlayer_MixTarget>` | :ref:`mix_target<class_AudioStreamPlayer_mix_target>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`pitch_scale<class_AudioStreamPlayer_pitch_scale>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`playing<class_AudioStreamPlayer_playing>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`AudioStream<class_AudioStream>` | :ref:`stream<class_AudioStreamPlayer_stream>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`stream_paused<class_AudioStreamPlayer_stream_paused>` |
+----------------------------------------------------+-------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`volume_db<class_AudioStreamPlayer_volume_db>` |
+----------------------------------------------------+-------------------------------------------------------------+
Methods
-------
+----------------------------+---------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayer_get_playback_position>` **(** **)** |
+----------------------------+---------------------------------------------------------------------------------------------------+
| void | :ref:`play<class_AudioStreamPlayer_play>` **(** :ref:`float<class_float>` from_position=0.0 **)** |
+----------------------------+---------------------------------------------------------------------------------------------------+
| void | :ref:`seek<class_AudioStreamPlayer_seek>` **(** :ref:`float<class_float>` to_position **)** |
+----------------------------+---------------------------------------------------------------------------------------------------+
| void | :ref:`stop<class_AudioStreamPlayer_stop>` **(** **)** |
+----------------------------+---------------------------------------------------------------------------------------------------+
Signals
-------
.. _class_AudioStreamPlayer_finished:
- **finished** **(** **)**
Emitted when the audio stops playing.
Enumerations
------------
.. _enum_AudioStreamPlayer_MixTarget:
enum **MixTarget**:
- **MIX_TARGET_STEREO** = **0** --- The audio will be played only on the first channel.
- **MIX_TARGET_SURROUND** = **1** --- The audio will be played on all surround channels.
- **MIX_TARGET_CENTER** = **2** --- The audio will be played on the second channel, which is usually the center.
Description
-----------
Plays background audio.
Tutorials
---------
- :doc:`../learning/features/audio/index`
- :doc:`../tutorials/audio/audio_streams`
Property Descriptions
---------------------
.. _class_AudioStreamPlayer_autoplay:
- :ref:`bool<class_bool>` **autoplay**
+----------+-----------------------+
| *Setter* | set_autoplay(value) |
+----------+-----------------------+
| *Getter* | is_autoplay_enabled() |
+----------+-----------------------+
If ``true``, audio plays when added to scene tree. Default value: ``false``.
.. _class_AudioStreamPlayer_bus:
- :ref:`String<class_String>` **bus**
+----------+----------------+
| *Setter* | set_bus(value) |
+----------+----------------+
| *Getter* | get_bus() |
+----------+----------------+
Bus on which this audio is playing.
.. _class_AudioStreamPlayer_mix_target:
- :ref:`MixTarget<enum_AudioStreamPlayer_MixTarget>` **mix_target**
+----------+-----------------------+
| *Setter* | set_mix_target(value) |
+----------+-----------------------+
| *Getter* | get_mix_target() |
+----------+-----------------------+
If the audio configuration has more than two speakers, this sets the target channels. See ``MIX_TARGET_*`` constants.
.. _class_AudioStreamPlayer_pitch_scale:
- :ref:`float<class_float>` **pitch_scale**
+----------+------------------------+
| *Setter* | set_pitch_scale(value) |
+----------+------------------------+
| *Getter* | get_pitch_scale() |
+----------+------------------------+
Changes the pitch and the tempo of the audio.
.. _class_AudioStreamPlayer_playing:
- :ref:`bool<class_bool>` **playing**
+----------+--------------+
| *Getter* | is_playing() |
+----------+--------------+
If ``true``, audio is playing.
.. _class_AudioStreamPlayer_stream:
- :ref:`AudioStream<class_AudioStream>` **stream**
+----------+-------------------+
| *Setter* | set_stream(value) |
+----------+-------------------+
| *Getter* | get_stream() |
+----------+-------------------+
The :ref:`AudioStream<class_AudioStream>` object to be played.
.. _class_AudioStreamPlayer_stream_paused:
- :ref:`bool<class_bool>` **stream_paused**
+----------+--------------------------+
| *Setter* | set_stream_paused(value) |
+----------+--------------------------+
| *Getter* | get_stream_paused() |
+----------+--------------------------+
.. _class_AudioStreamPlayer_volume_db:
- :ref:`float<class_float>` **volume_db**
+----------+----------------------+
| *Setter* | set_volume_db(value) |
+----------+----------------------+
| *Getter* | get_volume_db() |
+----------+----------------------+
Volume of sound, in dB.
Method Descriptions
-------------------
.. _class_AudioStreamPlayer_get_playback_position:
- :ref:`float<class_float>` **get_playback_position** **(** **)**
Returns the position in the :ref:`AudioStream<class_AudioStream>` in seconds.
.. _class_AudioStreamPlayer_play:
- void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
Plays the audio from the given position 'from_position', in seconds.
.. _class_AudioStreamPlayer_seek:
- void **seek** **(** :ref:`float<class_float>` to_position **)**
Sets the position from which audio will be played, in seconds.
.. _class_AudioStreamPlayer_stop:
- void **stop** **(** **)**
Stops the audio.