pandemonium_engine/doc/classes/AudioEffectCapture.xml

70 lines
3.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
2024-04-26 17:32:25 +02:00
<class name="AudioEffectCapture" inherits="AudioEffect" version="4.4">
<brief_description>
Captures audio from an audio bus in real-time.
</brief_description>
<description>
AudioEffectCapture is an AudioEffect which copies all audio frames from the attached audio effect bus into its internal ring buffer.
Application code should consume these audio frames from this ring buffer using [method get_buffer] and process it as needed, for example to capture data from an [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.
[b]Note:[/b] [member ProjectSettings.audio/enable_audio_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings.
</description>
<tutorials>
2023-08-29 22:33:15 +02:00
<link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.md</link>
<link title="Audio Mic Record Demo">https://github.com/Relintai/pandemonium_demo_projects/tree/master/audio/mic_record</link>
</tutorials>
<methods>
<method name="can_get_buffer" qualifiers="const">
<return type="bool" />
<argument index="0" name="frames" type="int" />
<description>
Returns [code]true[/code] if at least [code]frames[/code] audio frames are available to read in the internal ring buffer.
</description>
</method>
<method name="clear_buffer">
<return type="void" />
<description>
Clears the internal ring buffer.
</description>
</method>
<method name="get_buffer">
<return type="PoolVector2Array" />
<argument index="0" name="frames" type="int" />
<description>
Gets the next [code]frames[/code] audio samples from the internal ring buffer.
Returns a [PoolVector2Array] containing exactly [code]frames[/code] audio samples if available, or an empty [PoolVector2Array] if insufficient data was available.
</description>
</method>
<method name="get_buffer_length_frames" qualifiers="const">
<return type="int" />
<description>
Returns the total size of the internal ring buffer in frames.
</description>
</method>
<method name="get_discarded_frames" qualifiers="const">
<return type="int" />
<description>
Returns the number of audio frames discarded from the audio bus due to full buffer.
</description>
</method>
<method name="get_frames_available" qualifiers="const">
<return type="int" />
<description>
Returns the number of frames available to read using [method get_buffer].
</description>
</method>
<method name="get_pushed_frames" qualifiers="const">
<return type="int" />
<description>
Returns the number of audio frames inserted from the audio bus.
</description>
</method>
</methods>
<members>
<member name="buffer_length" type="float" setter="set_buffer_length" getter="get_buffer_length" default="0.1">
Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect if already initialized.
</member>
</members>
<constants>
</constants>
</class>