class_audiostreamgeneratorplayback.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/AudioStreamGeneratorPlayback.xml.
  6. .. _class_AudioStreamGeneratorPlayback:
  7. AudioStreamGeneratorPlayback
  8. ============================
  9. **Inherits:** :ref:`AudioStreamPlaybackResampled<class_AudioStreamPlaybackResampled>` **<** :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Plays back audio generated using :ref:`AudioStreamGenerator<class_AudioStreamGenerator>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This class is meant to be used with :ref:`AudioStreamGenerator<class_AudioStreamGenerator>` to play back the generated audio in real-time.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - `Audio Generator Demo <https://godotengine.org/asset-library/asset/526>`__
  19. - `Godot 3.2 will get new audio features <https://godotengine.org/article/godot-32-will-get-new-audio-features>`__
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`can_push_buffer<class_AudioStreamGeneratorPlayback_method_can_push_buffer>` **(** :ref:`int<class_int>` amount **)** |const| |
  27. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`clear_buffer<class_AudioStreamGeneratorPlayback_method_clear_buffer>` **(** **)** |
  29. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_frames_available<class_AudioStreamGeneratorPlayback_method_get_frames_available>` **(** **)** |const| |
  31. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_skips<class_AudioStreamGeneratorPlayback_method_get_skips>` **(** **)** |const| |
  33. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`push_buffer<class_AudioStreamGeneratorPlayback_method_push_buffer>` **(** :ref:`PackedVector2Array<class_PackedVector2Array>` frames **)** |
  35. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`push_frame<class_AudioStreamGeneratorPlayback_method_push_frame>` **(** :ref:`Vector2<class_Vector2>` frame **)** |
  37. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  38. .. rst-class:: classref-section-separator
  39. ----
  40. .. rst-class:: classref-descriptions-group
  41. Method Descriptions
  42. -------------------
  43. .. _class_AudioStreamGeneratorPlayback_method_can_push_buffer:
  44. .. rst-class:: classref-method
  45. :ref:`bool<class_bool>` **can_push_buffer** **(** :ref:`int<class_int>` amount **)** |const|
  46. Returns ``true`` if a buffer of the size ``amount`` can be pushed to the audio sample data buffer without overflowing it, ``false`` otherwise.
  47. .. rst-class:: classref-item-separator
  48. ----
  49. .. _class_AudioStreamGeneratorPlayback_method_clear_buffer:
  50. .. rst-class:: classref-method
  51. void **clear_buffer** **(** **)**
  52. Clears the audio sample data buffer.
  53. .. rst-class:: classref-item-separator
  54. ----
  55. .. _class_AudioStreamGeneratorPlayback_method_get_frames_available:
  56. .. rst-class:: classref-method
  57. :ref:`int<class_int>` **get_frames_available** **(** **)** |const|
  58. Returns the number of frames that can be pushed to the audio sample data buffer without overflowing it. If the result is ``0``, the buffer is full.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_AudioStreamGeneratorPlayback_method_get_skips:
  62. .. rst-class:: classref-method
  63. :ref:`int<class_int>` **get_skips** **(** **)** |const|
  64. Returns the number of times the playback skipped due to a buffer underrun in the audio sample data. This value is reset at the start of the playback.
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_AudioStreamGeneratorPlayback_method_push_buffer:
  68. .. rst-class:: classref-method
  69. :ref:`bool<class_bool>` **push_buffer** **(** :ref:`PackedVector2Array<class_PackedVector2Array>` frames **)**
  70. Pushes several audio data frames to the buffer. This is usually more efficient than :ref:`push_frame<class_AudioStreamGeneratorPlayback_method_push_frame>` in C# and compiled languages via GDExtension, but :ref:`push_buffer<class_AudioStreamGeneratorPlayback_method_push_buffer>` may be *less* efficient in GDScript.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_AudioStreamGeneratorPlayback_method_push_frame:
  74. .. rst-class:: classref-method
  75. :ref:`bool<class_bool>` **push_frame** **(** :ref:`Vector2<class_Vector2>` frame **)**
  76. Pushes a single audio data frame to the buffer. This is usually less efficient than :ref:`push_buffer<class_AudioStreamGeneratorPlayback_method_push_buffer>` in C# and compiled languages via GDExtension, but :ref:`push_frame<class_AudioStreamGeneratorPlayback_method_push_frame>` may be *more* efficient in GDScript.
  77. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  78. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  79. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  80. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  81. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  82. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  83. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`