Debian Codegraph @

doc/classes/AudioEffectCapture.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="AudioEffectCapture" inherits="AudioEffect" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Captures audio from an audio bus in real-time.
5 </brief_description>
6 <description>
7 AudioEffectCapture is an AudioEffect which copies all audio frames from the attached audio effect bus into its internal ring buffer.
8 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.
9 Unlike [AudioEffectRecord], this effect only returns the raw audio samples instead of encoding them into an [AudioStream].
10 </description>
11 <tutorials>
12 <link title="Audio buses">$DOCS_URL/tutorials/audio/audio_buses.html</link>
13 </tutorials>
14 <methods>
15 <method name="can_get_buffer" qualifiers="const">
16 <return type="bool" />
17 <param index="0" name="frames" type="int" />
18 <description>
19 Returns [code]true[/code] if at least [param frames] audio frames are available to read in the internal ring buffer.
20 </description>
21 </method>
22 <method name="clear_buffer">
23 <return type="void" />
24 <description>
25 Clears the internal ring buffer.
26 [b]Note:[/b] Calling this during a capture can cause the loss of samples which causes popping in the playback.
27 </description>
28 </method>
29 <method name="get_buffer">
30 <return type="PackedVector2Array" />
31 <param index="0" name="frames" type="int" />
32 <description>
33 Gets the next [param frames] audio samples from the internal ring buffer.
34 Returns a [PackedVector2Array] containing exactly [param frames] audio samples if available, or an empty [PackedVector2Array] if insufficient data was available.
35 The samples are signed floating-point PCM between [code]-1[/code] and [code]1[/code]. You will have to scale them if you want to use them as 8 or 16-bit integer samples. ([code]v = 0x7fff * samples[0].x[/code])
36 </description>
37 </method>
38 <method name="get_buffer_length_frames" qualifiers="const">
39 <return type="int" />
40 <description>
41 Returns the total size of the internal ring buffer in frames.
42 </description>
43 </method>
44 <method name="get_discarded_frames" qualifiers="const">
45 <return type="int" />
46 <description>
47 Returns the number of audio frames discarded from the audio bus due to full buffer.
48 </description>
49 </method>
50 <method name="get_frames_available" qualifiers="const">
51 <return type="int" />
52 <description>
53 Returns the number of frames available to read using [method get_buffer].
54 </description>
55 </method>
56 <method name="get_pushed_frames" qualifiers="const">
57 <return type="int" />
58 <description>
59 Returns the number of audio frames inserted from the audio bus.
60 </description>
61 </method>
62 </methods>
63 <members>
64 <member name="buffer_length" type="float" setter="set_buffer_length" getter="get_buffer_length" default="0.1">
65 Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect if already initialized.
66 </member>
67 </members>
68 </class>