From 182b9ef38efe592c1f5423c1621d7e07b4a5343f Mon Sep 17 00:00:00 2001 From: Robert Forsman Date: Tue, 7 Nov 2023 10:51:43 -0500 Subject: [PATCH] Add details about `AudioEffectCapture.clear_buffer()` and `get_buffer()` --- doc/classes/AudioEffectCapture.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/classes/AudioEffectCapture.xml b/doc/classes/AudioEffectCapture.xml index e17c5109078..ce516be5fc4 100644 --- a/doc/classes/AudioEffectCapture.xml +++ b/doc/classes/AudioEffectCapture.xml @@ -5,7 +5,7 @@ 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. + 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. Unlike [AudioEffectRecord], this effect only returns the raw audio samples instead of encoding them into an [AudioStream]. @@ -23,6 +23,7 @@ Clears the internal ring buffer. + [b]Note:[/b] Calling this during a capture can cause the loss of samples which causes popping in the playback. @@ -31,6 +32,7 @@ Gets the next [param frames] audio samples from the internal ring buffer. Returns a [PackedVector2Array] containing exactly [param frames] audio samples if available, or an empty [PackedVector2Array] if insufficient data was available. + 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])