class_eventplayer.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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_EventPlayer:
  4. EventPlayer
  5. ===========
  6. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Class for event stream playback.
  11. Member Functions
  12. ----------------
  13. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`float<class_float>` | :ref:`get_channel_last_note_time<class_EventPlayer_get_channel_last_note_time>` **(** :ref:`int<class_int>` channel **)** const |
  15. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`get_channel_volume<class_EventPlayer_get_channel_volume>` **(** :ref:`int<class_int>` channel **)** const |
  17. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`float<class_float>` | :ref:`get_length<class_EventPlayer_get_length>` **(** **)** const |
  19. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_loop_count<class_EventPlayer_get_loop_count>` **(** **)** const |
  21. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`get_pitch_scale<class_EventPlayer_get_pitch_scale>` **(** **)** const |
  23. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`float<class_float>` | :ref:`get_pos<class_EventPlayer_get_pos>` **(** **)** const |
  25. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`EventStream<class_eventstream>` | :ref:`get_stream<class_EventPlayer_get_stream>` **(** **)** const |
  27. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`String<class_string>` | :ref:`get_stream_name<class_EventPlayer_get_stream_name>` **(** **)** const |
  29. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`float<class_float>` | :ref:`get_tempo_scale<class_EventPlayer_get_tempo_scale>` **(** **)** const |
  31. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`float<class_float>` | :ref:`get_volume<class_EventPlayer_get_volume>` **(** **)** const |
  33. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`float<class_float>` | :ref:`get_volume_db<class_EventPlayer_get_volume_db>` **(** **)** const |
  35. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`has_autoplay<class_EventPlayer_has_autoplay>` **(** **)** const |
  37. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`has_loop<class_EventPlayer_has_loop>` **(** **)** const |
  39. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`is_paused<class_EventPlayer_is_paused>` **(** **)** const |
  41. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_playing<class_EventPlayer_is_playing>` **(** **)** const |
  43. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`play<class_EventPlayer_play>` **(** **)** |
  45. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`seek_pos<class_EventPlayer_seek_pos>` **(** :ref:`float<class_float>` time **)** |
  47. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_autoplay<class_EventPlayer_set_autoplay>` **(** :ref:`bool<class_bool>` enabled **)** |
  49. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_channel_volume<class_EventPlayer_set_channel_volume>` **(** :ref:`int<class_int>` channel, :ref:`float<class_float>` channel_volume **)** |
  51. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_loop<class_EventPlayer_set_loop>` **(** :ref:`bool<class_bool>` enabled **)** |
  53. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_paused<class_EventPlayer_set_paused>` **(** :ref:`bool<class_bool>` paused **)** |
  55. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_pitch_scale<class_EventPlayer_set_pitch_scale>` **(** :ref:`float<class_float>` pitch_scale **)** |
  57. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_stream<class_EventPlayer_set_stream>` **(** :ref:`EventStream<class_eventstream>` stream **)** |
  59. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_tempo_scale<class_EventPlayer_set_tempo_scale>` **(** :ref:`float<class_float>` tempo_scale **)** |
  61. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_volume<class_EventPlayer_set_volume>` **(** :ref:`float<class_float>` volume **)** |
  63. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_volume_db<class_EventPlayer_set_volume_db>` **(** :ref:`float<class_float>` db **)** |
  65. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`stop<class_EventPlayer_stop>` **(** **)** |
  67. +----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. Description
  69. -----------
  70. Class for event stream playback. Event streams are music expressed as a series of events (note on, note off, instrument change...), as opposed to audio streams, which are just audio data. Examples of event-based streams are MIDI files, or MOD music.
  71. Currently, only MOD, S3M, IT, and XM music is supported.
  72. Member Function Description
  73. ---------------------------
  74. .. _class_EventPlayer_get_channel_last_note_time:
  75. - :ref:`float<class_float>` **get_channel_last_note_time** **(** :ref:`int<class_int>` channel **)** const
  76. Return the time at which the last note of a given channel in the stream plays.
  77. .. _class_EventPlayer_get_channel_volume:
  78. - :ref:`float<class_float>` **get_channel_volume** **(** :ref:`int<class_int>` channel **)** const
  79. Return the volume scale for an individual channel of the stream.
  80. .. _class_EventPlayer_get_length:
  81. - :ref:`float<class_float>` **get_length** **(** **)** const
  82. Return the song length. May be in seconds, but depends on the stream type.
  83. .. _class_EventPlayer_get_loop_count:
  84. - :ref:`int<class_int>` **get_loop_count** **(** **)** const
  85. Return the number of times the playback has looped.
  86. .. _class_EventPlayer_get_pitch_scale:
  87. - :ref:`float<class_float>` **get_pitch_scale** **(** **)** const
  88. Return the pitch scale factor for this player.
  89. .. _class_EventPlayer_get_pos:
  90. - :ref:`float<class_float>` **get_pos** **(** **)** const
  91. Return the playback position. May be in seconds, but depends on the stream type.
  92. .. _class_EventPlayer_get_stream:
  93. - :ref:`EventStream<class_eventstream>` **get_stream** **(** **)** const
  94. Return the currently assigned stream.
  95. .. _class_EventPlayer_get_stream_name:
  96. - :ref:`String<class_string>` **get_stream_name** **(** **)** const
  97. 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>".
  98. .. _class_EventPlayer_get_tempo_scale:
  99. - :ref:`float<class_float>` **get_tempo_scale** **(** **)** const
  100. Return the tempo multiplier.
  101. .. _class_EventPlayer_get_volume:
  102. - :ref:`float<class_float>` **get_volume** **(** **)** const
  103. Return the playback volume for this player.
  104. .. _class_EventPlayer_get_volume_db:
  105. - :ref:`float<class_float>` **get_volume_db** **(** **)** const
  106. Return the playback volume for this player, in decibels.
  107. .. _class_EventPlayer_has_autoplay:
  108. - :ref:`bool<class_bool>` **has_autoplay** **(** **)** const
  109. Return whether this player will start playing as soon as it enters the scene tree.
  110. .. _class_EventPlayer_has_loop:
  111. - :ref:`bool<class_bool>` **has_loop** **(** **)** const
  112. Return whether this player will be restart the playback at the end.
  113. .. _class_EventPlayer_is_paused:
  114. - :ref:`bool<class_bool>` **is_paused** **(** **)** const
  115. Return whether the playback is currently paused.
  116. .. _class_EventPlayer_is_playing:
  117. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  118. Return whether this player is playing.
  119. .. _class_EventPlayer_play:
  120. - void **play** **(** **)**
  121. Play the currently assigned stream.
  122. .. _class_EventPlayer_seek_pos:
  123. - void **seek_pos** **(** :ref:`float<class_float>` time **)**
  124. Set the playback position. May be in seconds, but depends on the stream type.
  125. .. _class_EventPlayer_set_autoplay:
  126. - void **set_autoplay** **(** :ref:`bool<class_bool>` enabled **)**
  127. Set whether this player will start playing as soon as it enters the scene tree.
  128. .. _class_EventPlayer_set_channel_volume:
  129. - void **set_channel_volume** **(** :ref:`int<class_int>` channel, :ref:`float<class_float>` channel_volume **)**
  130. Set the volume scale for an individual channel of the stream, with the same value range as :ref:`set_volume<class_EventPlayer_set_volume>`. The channel number depends on the stream format. For example, MIDIs range from 0 to 15, and MODs from 0 to 63.
  131. Many stream formats are multichannel, so this allows to affect only a part of the music.
  132. .. _class_EventPlayer_set_loop:
  133. - void **set_loop** **(** :ref:`bool<class_bool>` enabled **)**
  134. Set whether the stream will be restarted at the end.
  135. .. _class_EventPlayer_set_paused:
  136. - void **set_paused** **(** :ref:`bool<class_bool>` paused **)**
  137. Pause stream playback.
  138. .. _class_EventPlayer_set_pitch_scale:
  139. - void **set_pitch_scale** **(** :ref:`float<class_float>` pitch_scale **)**
  140. Set the pitch multiplier for all sounds coming from this stream. A value of 2.0 shifts all pitches one octave up, and a value of 0.5 shifts pitches one octave down.
  141. .. _class_EventPlayer_set_stream:
  142. - void **set_stream** **(** :ref:`EventStream<class_eventstream>` stream **)**
  143. Set the :ref:`EventStream<class_eventstream>` this player will play.
  144. .. _class_EventPlayer_set_tempo_scale:
  145. - void **set_tempo_scale** **(** :ref:`float<class_float>` tempo_scale **)**
  146. Set the tempo multiplier. This allows to slow down or speed up the music, without affecting its pitch.
  147. .. _class_EventPlayer_set_volume:
  148. - void **set_volume** **(** :ref:`float<class_float>` volume **)**
  149. Set the playback volume for this player. This is a float between 0.0 (silent) and 1.0 (full volume). Values over 1.0 may amplify sound even more, but may introduce distortion. Negative values may just invert the output waveform, which produces no audible difference.
  150. The effect of these special values ultimately depends on the low-level implementation of the file format being played.
  151. .. _class_EventPlayer_set_volume_db:
  152. - void **set_volume_db** **(** :ref:`float<class_float>` db **)**
  153. 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 over amplifying (see :ref:`set_volume<class_EventPlayer_set_volume>`) still apply.
  154. .. _class_EventPlayer_stop:
  155. - void **stop** **(** **)**
  156. Stop playing.