class_streamplayer.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_StreamPlayer:
  4. StreamPlayer
  5. ============
  6. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Base class for audio stream playback.
  11. Member Functions
  12. ----------------
  13. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`int<class_int>` | :ref:`get_buffering_msec<class_StreamPlayer_get_buffering_msec>` **(** **)** const |
  15. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`get_length<class_StreamPlayer_get_length>` **(** **)** const |
  17. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`get_loop_count<class_StreamPlayer_get_loop_count>` **(** **)** const |
  19. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`get_loop_restart_time<class_StreamPlayer_get_loop_restart_time>` **(** **)** const |
  21. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`get_pos<class_StreamPlayer_get_pos>` **(** **)** const |
  23. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`AudioStream<class_audiostream>` | :ref:`get_stream<class_StreamPlayer_get_stream>` **(** **)** const |
  25. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_string>` | :ref:`get_stream_name<class_StreamPlayer_get_stream_name>` **(** **)** const |
  27. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`get_volume<class_StreamPlayer_get_volume>` **(** **)** const |
  29. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`float<class_float>` | :ref:`get_volume_db<class_StreamPlayer_get_volume_db>` **(** **)** const |
  31. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`has_autoplay<class_StreamPlayer_has_autoplay>` **(** **)** const |
  33. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`has_loop<class_StreamPlayer_has_loop>` **(** **)** const |
  35. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`is_paused<class_StreamPlayer_is_paused>` **(** **)** const |
  37. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`is_playing<class_StreamPlayer_is_playing>` **(** **)** const |
  39. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`play<class_StreamPlayer_play>` **(** :ref:`float<class_float>` offset=0 **)** |
  41. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`seek_pos<class_StreamPlayer_seek_pos>` **(** :ref:`float<class_float>` time **)** |
  43. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_autoplay<class_StreamPlayer_set_autoplay>` **(** :ref:`bool<class_bool>` enabled **)** |
  45. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_buffering_msec<class_StreamPlayer_set_buffering_msec>` **(** :ref:`int<class_int>` msec **)** |
  47. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_loop<class_StreamPlayer_set_loop>` **(** :ref:`bool<class_bool>` enabled **)** |
  49. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_loop_restart_time<class_StreamPlayer_set_loop_restart_time>` **(** :ref:`float<class_float>` secs **)** |
  51. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_paused<class_StreamPlayer_set_paused>` **(** :ref:`bool<class_bool>` paused **)** |
  53. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_stream<class_StreamPlayer_set_stream>` **(** :ref:`AudioStream<class_audiostream>` stream **)** |
  55. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_volume<class_StreamPlayer_set_volume>` **(** :ref:`float<class_float>` volume **)** |
  57. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_volume_db<class_StreamPlayer_set_volume_db>` **(** :ref:`float<class_float>` db **)** |
  59. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`stop<class_StreamPlayer_stop>` **(** **)** |
  61. +----------------------------------------+---------------------------------------------------------------------------------------------------------------------+
  62. Signals
  63. -------
  64. - **finished** **(** **)**
  65. This signal triggers when the player stops playing. It will not trigger on each loop.
  66. Description
  67. -----------
  68. Base class for audio stream playback. Audio stream players inherit from it.
  69. Member Function Description
  70. ---------------------------
  71. .. _class_StreamPlayer_get_buffering_msec:
  72. - :ref:`int<class_int>` **get_buffering_msec** **(** **)** const
  73. Return the size of the audio buffer.
  74. .. _class_StreamPlayer_get_length:
  75. - :ref:`float<class_float>` **get_length** **(** **)** const
  76. Return the length of the stream, in seconds.
  77. .. _class_StreamPlayer_get_loop_count:
  78. - :ref:`int<class_int>` **get_loop_count** **(** **)** const
  79. Return the number of times the playback has looped.
  80. .. _class_StreamPlayer_get_loop_restart_time:
  81. - :ref:`float<class_float>` **get_loop_restart_time** **(** **)** const
  82. Return the point in time the stream will rewind to, when looping.
  83. .. _class_StreamPlayer_get_pos:
  84. - :ref:`float<class_float>` **get_pos** **(** **)** const
  85. Return the playback position, in seconds.
  86. .. _class_StreamPlayer_get_stream:
  87. - :ref:`AudioStream<class_audiostream>` **get_stream** **(** **)** const
  88. Return the currently assigned stream.
  89. .. _class_StreamPlayer_get_stream_name:
  90. - :ref:`String<class_string>` **get_stream_name** **(** **)** const
  91. Return the name of the currently assigned stream. This is not the file name, but a field inside the file. If no stream is assigned, if returns "<No Stream>".
  92. .. _class_StreamPlayer_get_volume:
  93. - :ref:`float<class_float>` **get_volume** **(** **)** const
  94. Return the playback volume for this player.
  95. .. _class_StreamPlayer_get_volume_db:
  96. - :ref:`float<class_float>` **get_volume_db** **(** **)** const
  97. Return the playback volume for this player, in decibels.
  98. .. _class_StreamPlayer_has_autoplay:
  99. - :ref:`bool<class_bool>` **has_autoplay** **(** **)** const
  100. Return whether this player will start playing as soon as it enters the scene tree.
  101. .. _class_StreamPlayer_has_loop:
  102. - :ref:`bool<class_bool>` **has_loop** **(** **)** const
  103. Return whether the stream will be restarted at the end.
  104. .. _class_StreamPlayer_is_paused:
  105. - :ref:`bool<class_bool>` **is_paused** **(** **)** const
  106. Return whether the playback is currently paused.
  107. .. _class_StreamPlayer_is_playing:
  108. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  109. Return whether this player is playing.
  110. .. _class_StreamPlayer_play:
  111. - void **play** **(** :ref:`float<class_float>` offset=0 **)**
  112. Play the currently assigned stream, starting from a given position (in seconds).
  113. .. _class_StreamPlayer_seek_pos:
  114. - void **seek_pos** **(** :ref:`float<class_float>` time **)**
  115. Set the playback position, in seconds.
  116. .. _class_StreamPlayer_set_autoplay:
  117. - void **set_autoplay** **(** :ref:`bool<class_bool>` enabled **)**
  118. Set whether this player will start playing as soon as it enters the scene tree.
  119. .. _class_StreamPlayer_set_buffering_msec:
  120. - void **set_buffering_msec** **(** :ref:`int<class_int>` msec **)**
  121. Set the size (in milliseconds) of the audio buffer. A long audio buffer protects better against slowdowns, but responds worse to changes (in volume, stream played...). A shorter buffer takes less time to respond to changes, but may stutter if the application suffers some slowdown.
  122. Default is 500 milliseconds.
  123. .. _class_StreamPlayer_set_loop:
  124. - void **set_loop** **(** :ref:`bool<class_bool>` enabled **)**
  125. Set whether the stream will be restarted at the end.
  126. .. _class_StreamPlayer_set_loop_restart_time:
  127. - void **set_loop_restart_time** **(** :ref:`float<class_float>` secs **)**
  128. Set the point in time the stream will rewind to, when looping.
  129. .. _class_StreamPlayer_set_paused:
  130. - void **set_paused** **(** :ref:`bool<class_bool>` paused **)**
  131. Pause stream playback.
  132. .. _class_StreamPlayer_set_stream:
  133. - void **set_stream** **(** :ref:`AudioStream<class_audiostream>` stream **)**
  134. Set the :ref:`EventStream<class_eventstream>` this player will play.
  135. .. _class_StreamPlayer_set_volume:
  136. - void **set_volume** **(** :ref:`float<class_float>` volume **)**
  137. Set the playback volume for this player. This is a float between 0.0 (silent) and 1.0 (full volume). Values over 1.0 will amplify sound even more, but may introduce distortion. Negative values will just invert the output waveform, which produces no audible difference.
  138. .. _class_StreamPlayer_set_volume_db:
  139. - void **set_volume_db** **(** :ref:`float<class_float>` db **)**
  140. Set the playback volume for this player, in decibels. This is a float between -80.0 (silent) and 0.0 (full volume). Values under -79.0 get truncated to -80, but values over 0.0 do not, so the warnings for overamplifying (see :ref:`set_volume<class_StreamPlayer_set_volume>`) still apply.
  141. .. _class_StreamPlayer_stop:
  142. - void **stop** **(** **)**
  143. Stop the playback.