summaryrefslogtreecommitdiff
path: root/doc/classes/AudioEffectCapture.xml
blob: c7ee621ca648bca48fbfbe12f99afe487c8cee8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AudioEffectCapture" inherits="AudioEffect" version="4.0">
	<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 a microphone, implement application defined effects, or to transmit audio over the network.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="can_get_buffer" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="frames" type="int">
			</argument>
			<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">
			</return>
			<description>
				Clears the internal ring buffer.
			</description>
		</method>
		<method name="get_buffer">
			<return type="PackedVector2Array">
			</return>
			<argument index="0" name="frames" type="int">
			</argument>
			<description>
				Gets the next [code]frames[/code] audio samples from the internal ring buffer.
				Returns a [PackedVector2Array] containing exactly [code]frames[/code] audio samples if available, or an empty [PackedVector2Array] if insufficient data was available.
			</description>
		</method>
		<method name="get_buffer_length_frames" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the total size of the internal ring buffer in frames.
			</description>
		</method>
		<method name="get_discarded_frames" qualifiers="const">
			<return type="int">
			</return>
			<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">
			</return>
			<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">
			</return>
			<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>