class_audiostreamgeneratorplayback.rst 5.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the AudioStreamGeneratorPlayback.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AudioStreamGeneratorPlayback:
  6. AudioStreamGeneratorPlayback
  7. ============================
  8. **Inherits:** :ref:`AudioStreamPlaybackResampled<class_AudioStreamPlaybackResampled>` **<** :ref:`AudioStreamPlayback<class_AudioStreamPlayback>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. Plays back audio generated using :ref:`AudioStreamGenerator<class_AudioStreamGenerator>`.
  10. Description
  11. -----------
  12. This class is meant to be used with :ref:`AudioStreamGenerator<class_AudioStreamGenerator>` to play back the generated audio in real-time.
  13. Tutorials
  14. ---------
  15. - `Audio Generator Demo <https://godotengine.org/asset-library/asset/526>`__
  16. - `Godot 3.2 will get new audio features <https://godotengine.org/article/godot-32-will-get-new-audio-features>`__
  17. Methods
  18. -------
  19. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`can_push_buffer<class_AudioStreamGeneratorPlayback_method_can_push_buffer>` **(** :ref:`int<class_int>` amount **)** |const| |
  21. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`clear_buffer<class_AudioStreamGeneratorPlayback_method_clear_buffer>` **(** **)** |
  23. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_frames_available<class_AudioStreamGeneratorPlayback_method_get_frames_available>` **(** **)** |const| |
  25. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_skips<class_AudioStreamGeneratorPlayback_method_get_skips>` **(** **)** |const| |
  27. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`push_buffer<class_AudioStreamGeneratorPlayback_method_push_buffer>` **(** :ref:`PackedVector2Array<class_PackedVector2Array>` frames **)** |
  29. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`push_frame<class_AudioStreamGeneratorPlayback_method_push_frame>` **(** :ref:`Vector2<class_Vector2>` frame **)** |
  31. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
  32. Method Descriptions
  33. -------------------
  34. .. _class_AudioStreamGeneratorPlayback_method_can_push_buffer:
  35. - :ref:`bool<class_bool>` **can_push_buffer** **(** :ref:`int<class_int>` amount **)** |const|
  36. Returns ``true`` if a buffer of the size ``amount`` can be pushed to the audio sample data buffer without overflowing it, ``false`` otherwise.
  37. ----
  38. .. _class_AudioStreamGeneratorPlayback_method_clear_buffer:
  39. - void **clear_buffer** **(** **)**
  40. Clears the audio sample data buffer.
  41. ----
  42. .. _class_AudioStreamGeneratorPlayback_method_get_frames_available:
  43. - :ref:`int<class_int>` **get_frames_available** **(** **)** |const|
  44. Returns the number of audio data frames left to play. If this returned number reaches ``0``, the audio will stop playing until frames are added again. Therefore, make sure your script can always generate and push new audio frames fast enough to avoid audio cracking.
  45. ----
  46. .. _class_AudioStreamGeneratorPlayback_method_get_skips:
  47. - :ref:`int<class_int>` **get_skips** **(** **)** |const|
  48. ----
  49. .. _class_AudioStreamGeneratorPlayback_method_push_buffer:
  50. - :ref:`bool<class_bool>` **push_buffer** **(** :ref:`PackedVector2Array<class_PackedVector2Array>` frames **)**
  51. 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.
  52. ----
  53. .. _class_AudioStreamGeneratorPlayback_method_push_frame:
  54. - :ref:`bool<class_bool>` **push_frame** **(** :ref:`Vector2<class_Vector2>` frame **)**
  55. 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.
  56. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  57. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  58. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  59. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  60. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  61. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`