Class AudioEffectCapture
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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 GetBuffer(int) 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.
Note:
ProjectSettings.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.
public class AudioEffectCapture : AudioEffect, IDisposable
- Inheritance
-
AudioEffectCapture
- Implements
- Inherited Members
Constructors
AudioEffectCapture()
public AudioEffectCapture()
Properties
BufferLength
Length of the internal ring buffer, in seconds. Setting the buffer length will have no effect if already initialized.
public float BufferLength { get; set; }
Property Value
Methods
CanGetBuffer(int)
Returns true
if at least frames
audio frames are available to read in the internal ring buffer.
public bool CanGetBuffer(int frames)
Parameters
frames
int
Returns
ClearBuffer()
Clears the internal ring buffer.
public void ClearBuffer()
GetBuffer(int)
Gets the next frames
audio samples from the internal ring buffer.
Returns a Vector2[] containing exactly frames
audio samples if available, or an empty Vector2[] if insufficient data was available.
public Vector2[] GetBuffer(int frames)
Parameters
frames
int
Returns
- Vector2[]
GetBufferLengthFrames()
Returns the total size of the internal ring buffer in frames.
public int GetBufferLengthFrames()
Returns
GetDiscardedFrames()
Returns the number of audio frames discarded from the audio bus due to full buffer.
public long GetDiscardedFrames()
Returns
GetFramesAvailable()
Returns the number of frames available to read using GetBuffer(int).
public int GetFramesAvailable()
Returns
GetPushedFrames()
Returns the number of audio frames inserted from the audio bus.
public long GetPushedFrames()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.