AudioEffectCapture

Hereda: AudioEffect < Resource < RefCounted < Object

Captura el audio de un bus de audio en tiempo real.

Descripción

AudioEffectCapture es un AudioEffect que copia todos los fotogramas de audio del bus de efectos de audio adjunto en su búfer de anillo interno.

El código de la aplicación debe consumir estos fotogramas de audio de este búfer de anillo utilizando get_buffer() y procesarlos según sea necesario, por ejemplo, para capturar datos de un AudioStreamMicrophone, implementar efectos definidos por la aplicación o para transmitir audio a través de la red. Al capturar datos de audio de un micrófono, el formato de las muestras será PCM estéreo de punto flotante de 32 bits.

A diferencia de AudioEffectRecord, este efecto solo devuelve las muestras de audio sin procesar en lugar de codificarlas en un AudioStream.

Tutoriales

Propiedades

float

buffer_length

0.1

Métodos

bool

can_get_buffer(frames: int) const

void

clear_buffer()

PackedVector2Array

get_buffer(frames: int)

int

get_buffer_length_frames() const

int

get_discarded_frames() const

int

get_frames_available() const

int

get_pushed_frames() const


Descripciones de Propiedades

float buffer_length = 0.1 🔗

  • void set_buffer_length(value: float)

  • float get_buffer_length()

Longitud del búfer de anillo interno, en segundos. Establecer la longitud del búfer no tendrá efecto si ya ha sido inicializado.


Descripciones de Métodos

bool can_get_buffer(frames: int) const 🔗

Devuelve true si al menos frames fotogramas de audio están disponibles para leer en el búfer de anillo interno.


void clear_buffer() 🔗

Clears the internal ring buffer.

Note: Calling this during a capture can cause the loss of samples which causes popping in the playback.


PackedVector2Array get_buffer(frames: int) 🔗

Gets the next frames audio samples from the internal ring buffer.

Returns a PackedVector2Array containing exactly frames audio samples if available, or an empty PackedVector2Array if insufficient data was available.

The samples are signed floating-point PCM between -1 and 1. You will have to scale them if you want to use them as 8 or 16-bit integer samples. (v = 0x7fff * samples[0].x)


int get_buffer_length_frames() const 🔗

Returns the total size of the internal ring buffer in frames.


int get_discarded_frames() const 🔗

Returns the number of audio frames discarded from the audio bus due to full buffer.


int get_frames_available() const 🔗

Returns the number of frames available to read using get_buffer().


int get_pushed_frames() const 🔗

Returns the number of audio frames inserted from the audio bus.