|
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<class name="MicrophoneFeed" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | + <brief_description> |
| 4 | + A microphone feed gives you access to a single physical microphone attached to your device. |
| 5 | + </brief_description> |
| 6 | + <description> |
| 7 | + A microphone feed gives you access to a single physical microphone attached to your device. |
| 8 | + When enabled, Godot will start acquiring stereo sample frames at the [method AudioServer.get_input_mix_rate] |
| 9 | + and writing them into an internal buffer of size [method get_buffer_length_frames]. |
| 10 | + </description> |
| 11 | + <tutorials> |
| 12 | + </tutorials> |
| 13 | + <methods> |
| 14 | + <method name="get_buffer_length_frames"> |
| 15 | + <return type="int" /> |
| 16 | + <description> |
| 17 | + Returns the absolute size of the microphone input buffer. |
| 18 | + This is set as some multiple of the audio latency and can be used to |
| 19 | + estimate the minimum rate at which the frames are fetched. |
| 20 | + </description> |
| 21 | + </method> |
| 22 | + <method name="get_frames"> |
| 23 | + <return type="PackedVector2Array" /> |
| 24 | + <param index="0" name="frames" type="int" /> |
| 25 | + <description> |
| 26 | + Gets the next [param frames] audio samples from the internal microphone buffer. |
| 27 | + The buffer is filled at the rate of [method AudioServer.get_input_mix_rate] frames per second when [member feed_is_active] is true. |
| 28 | + Returns a [PackedVector2Array] containing exactly [param frames] audio samples if available, or an empty [PackedVector2Array]. |
| 29 | + 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]) |
| 30 | + </description> |
| 31 | + </method> |
| 32 | + <method name="get_frames_available"> |
| 33 | + <return type="int" /> |
| 34 | + <description> |
| 35 | + Returns the number of frames available to read using [method get_frames]. |
| 36 | + </description> |
| 37 | + </method> |
| 38 | + <method name="get_name" qualifiers="const"> |
| 39 | + <return type="String" /> |
| 40 | + <description> |
| 41 | + Returns the microphone's name. |
| 42 | + </description> |
| 43 | + </method> |
| 44 | + <method name="set_name"> |
| 45 | + <return type="void" /> |
| 46 | + <param index="0" name="name" type="String" /> |
| 47 | + <description> |
| 48 | + Sets the microphone's name. |
| 49 | + </description> |
| 50 | + </method> |
| 51 | + </methods> |
| 52 | + <members> |
| 53 | + <member name="feed_is_active" type="bool" setter="set_active" getter="is_active" default="false"> |
| 54 | + If [code]true[/code], the microphone feed is active. |
| 55 | + </member> |
| 56 | + </members> |
| 57 | +</class> |
0 commit comments