class_audioeffectcapture.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectCapture.xml.
  6. .. _class_AudioEffectCapture:
  7. AudioEffectCapture
  8. ==================
  9. **Inherits:** :ref:`AudioEffect<class_AudioEffect>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Captures audio from an audio bus in real-time.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. AudioEffectCapture is an AudioEffect which copies all audio frames from the attached audio effect bus into its internal ring buffer.
  15. Application code should consume these audio frames from this ring buffer using :ref:`get_buffer<class_AudioEffectCapture_method_get_buffer>` and process it as needed, for example to capture data from an :ref:`AudioStreamMicrophone<class_AudioStreamMicrophone>`, implement application-defined effects, or to transmit audio over the network. When capturing audio data from a microphone, the format of the samples will be stereo 32-bit floating point PCM.
  16. \ **Note:** :ref:`ProjectSettings.audio/driver/enable_input<class_ProjectSettings_property_audio/driver/enable_input>` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`Audio buses <../tutorials/audio/audio_buses>`
  21. - `Audio Mic Record Demo <https://github.com/godotengine/godot-demo-projects/tree/master/audio/mic_record>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +---------------------------+-----------------------------------------------------------------------+---------+
  28. | :ref:`float<class_float>` | :ref:`buffer_length<class_AudioEffectCapture_property_buffer_length>` | ``0.1`` |
  29. +---------------------------+-----------------------------------------------------------------------+---------+
  30. .. rst-class:: classref-reftable-group
  31. Methods
  32. -------
  33. .. table::
  34. :widths: auto
  35. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`can_get_buffer<class_AudioEffectCapture_method_can_get_buffer>` **(** :ref:`int<class_int>` frames **)** |const| |
  37. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`clear_buffer<class_AudioEffectCapture_method_clear_buffer>` **(** **)** |
  39. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_buffer<class_AudioEffectCapture_method_get_buffer>` **(** :ref:`int<class_int>` frames **)** |
  41. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_buffer_length_frames<class_AudioEffectCapture_method_get_buffer_length_frames>` **(** **)** |const| |
  43. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`get_discarded_frames<class_AudioEffectCapture_method_get_discarded_frames>` **(** **)** |const| |
  45. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`get_frames_available<class_AudioEffectCapture_method_get_frames_available>` **(** **)** |const| |
  47. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_pushed_frames<class_AudioEffectCapture_method_get_pushed_frames>` **(** **)** |const| |
  49. +-----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
  50. .. rst-class:: classref-section-separator
  51. ----
  52. .. rst-class:: classref-descriptions-group
  53. Property Descriptions
  54. ---------------------
  55. .. _class_AudioEffectCapture_property_buffer_length:
  56. .. rst-class:: classref-property
  57. :ref:`float<class_float>` **buffer_length** = ``0.1``
  58. .. rst-class:: classref-property-setget
  59. - void **set_buffer_length** **(** :ref:`float<class_float>` value **)**
  60. - :ref:`float<class_float>` **get_buffer_length** **(** **)**
  61. Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect if already initialized.
  62. .. rst-class:: classref-section-separator
  63. ----
  64. .. rst-class:: classref-descriptions-group
  65. Method Descriptions
  66. -------------------
  67. .. _class_AudioEffectCapture_method_can_get_buffer:
  68. .. rst-class:: classref-method
  69. :ref:`bool<class_bool>` **can_get_buffer** **(** :ref:`int<class_int>` frames **)** |const|
  70. Returns ``true`` if at least ``frames`` audio frames are available to read in the internal ring buffer.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_AudioEffectCapture_method_clear_buffer:
  74. .. rst-class:: classref-method
  75. void **clear_buffer** **(** **)**
  76. Clears the internal ring buffer.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_AudioEffectCapture_method_get_buffer:
  80. .. rst-class:: classref-method
  81. :ref:`PackedVector2Array<class_PackedVector2Array>` **get_buffer** **(** :ref:`int<class_int>` frames **)**
  82. Gets the next ``frames`` audio samples from the internal ring buffer.
  83. Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` containing exactly ``frames`` audio samples if available, or an empty :ref:`PackedVector2Array<class_PackedVector2Array>` if insufficient data was available.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_AudioEffectCapture_method_get_buffer_length_frames:
  87. .. rst-class:: classref-method
  88. :ref:`int<class_int>` **get_buffer_length_frames** **(** **)** |const|
  89. Returns the total size of the internal ring buffer in frames.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_AudioEffectCapture_method_get_discarded_frames:
  93. .. rst-class:: classref-method
  94. :ref:`int<class_int>` **get_discarded_frames** **(** **)** |const|
  95. Returns the number of audio frames discarded from the audio bus due to full buffer.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_AudioEffectCapture_method_get_frames_available:
  99. .. rst-class:: classref-method
  100. :ref:`int<class_int>` **get_frames_available** **(** **)** |const|
  101. Returns the number of frames available to read using :ref:`get_buffer<class_AudioEffectCapture_method_get_buffer>`.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_AudioEffectCapture_method_get_pushed_frames:
  105. .. rst-class:: classref-method
  106. :ref:`int<class_int>` **get_pushed_frames** **(** **)** |const|
  107. Returns the number of audio frames inserted from the audio bus.
  108. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  109. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  110. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  111. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  112. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  113. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  114. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`