class_audiostreamplayer.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the AudioStreamPlayer.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_AudioStreamPlayer:
  5. AudioStreamPlayer
  6. =================
  7. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Plays back audio.
  12. Methods
  13. -------
  14. +----------------------------+---------------------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`get_playback_position<class_AudioStreamPlayer_get_playback_position>` **(** **)** |
  16. +----------------------------+---------------------------------------------------------------------------------------------------+
  17. | void | :ref:`play<class_AudioStreamPlayer_play>` **(** :ref:`float<class_float>` from_position=0.0 **)** |
  18. +----------------------------+---------------------------------------------------------------------------------------------------+
  19. | void | :ref:`seek<class_AudioStreamPlayer_seek>` **(** :ref:`float<class_float>` to_position **)** |
  20. +----------------------------+---------------------------------------------------------------------------------------------------+
  21. | void | :ref:`stop<class_AudioStreamPlayer_stop>` **(** **)** |
  22. +----------------------------+---------------------------------------------------------------------------------------------------+
  23. Signals
  24. -------
  25. .. _class_AudioStreamPlayer_finished:
  26. - **finished** **(** **)**
  27. Emitted when the audio stops playing.
  28. Enumerations
  29. ------------
  30. .. _enum_AudioStreamPlayer_MixTarget:
  31. enum **MixTarget**
  32. - **MIX_TARGET_STEREO** = **0** --- The audio will be played only on the first channel.
  33. - **MIX_TARGET_SURROUND** = **1** --- The audio will be played on all surround channels.
  34. - **MIX_TARGET_CENTER** = **2** --- The audio will be played on the second channel, which is usually the center.
  35. Description
  36. -----------
  37. Plays background audio.
  38. Tutorials
  39. ---------
  40. - :doc:`../learning/features/audio/index`
  41. - :doc:`../tutorials/audio/audio_streams`
  42. Property Descriptions
  43. ---------------------
  44. .. _class_AudioStreamPlayer_autoplay:
  45. - :ref:`bool<class_bool>` **autoplay** - If ``true`` audio plays when added to scene tree. Default value: ``false``.
  46. .. _class_AudioStreamPlayer_bus:
  47. - :ref:`String<class_String>` **bus** - Bus on which this audio is playing.
  48. .. _class_AudioStreamPlayer_mix_target:
  49. - :ref:`MixTarget<enum_AudioStreamPlayer_MixTarget>` **mix_target** - If the audio configuration has more than two speakers, this sets the target channels. See ``MIX_TARGET_*`` constants.
  50. .. _class_AudioStreamPlayer_pitch_scale:
  51. - :ref:`float<class_float>` **pitch_scale** - Changes the pitch and the tempo of the audio.
  52. .. _class_AudioStreamPlayer_playing:
  53. - :ref:`bool<class_bool>` **playing** - If ``true`` audio is playing.
  54. .. _class_AudioStreamPlayer_stream:
  55. - :ref:`AudioStream<class_AudioStream>` **stream** - The :ref:`AudioStream<class_AudioStream>` object to be played.
  56. .. _class_AudioStreamPlayer_stream_paused:
  57. - :ref:`bool<class_bool>` **stream_paused**
  58. .. _class_AudioStreamPlayer_volume_db:
  59. - :ref:`float<class_float>` **volume_db** - Volume of sound, in dB.
  60. Method Descriptions
  61. -------------------
  62. .. _class_AudioStreamPlayer_get_playback_position:
  63. - :ref:`float<class_float>` **get_playback_position** **(** **)**
  64. Returns the position in the :ref:`AudioStream<class_AudioStream>` in seconds.
  65. .. _class_AudioStreamPlayer_play:
  66. - void **play** **(** :ref:`float<class_float>` from_position=0.0 **)**
  67. Plays the audio from the given position 'from_position', in seconds.
  68. .. _class_AudioStreamPlayer_seek:
  69. - void **seek** **(** :ref:`float<class_float>` to_position **)**
  70. Sets the position from which audio will be played, in seconds.
  71. .. _class_AudioStreamPlayer_stop:
  72. - void **stop** **(** **)**
  73. Stops the audio.