UnrealVoxta 0.1.1
 
Loading...
Searching...
No Matches
AudioCaptureHandler Class Reference

AudioCaptureHandler. More...

#include <AudioCaptureHandler.h>

Public Member Functions

void RegisterSocket (TWeakPtr< AudioWebSocket > socket, int bufferMillisecondSize)
 Store a pointer to the websocket that will receive the parsed data from the FVoiceModule.
 
bool TryInitializeVoiceCapture (int sampleRate=16000, int numChannels=1)
 Tries to create a voice capture instance (IVoiceCapture).
 
void ConfigureSilenceThresholds (float micNoiseGateThreshold, float silenceDetectionThreshold, float micInputGain)
 Configure values to help the microphone to pick up voice without background noise.
 
bool TryStartVoiceCapture ()
 Tries to start that IVoiceCapture and also start the background thread that will forward any captured data every fixed timestep.
 
void StopCapture ()
 Stop the voice capture, reset the buffers and stops the background thread.
 
void ShutDown (bool alsoDestroyCaptureDevice=false)
 Stops the capture, permanently clearing the reserved memory for the background thread.
 
bool IsInputSilent () const
 
float GetDecibels () const
 
const FString & GetDeviceName () const
 
void SetIsTestMode (bool isTestMode)
 

Friends

class FVoiceRunnerThread
 The background thread needs access to our private functions.
 

Detailed Description

AudioCaptureHandler.

Handles audio input by wrapping the engine's inner FVoiceModule. On fixed intervals, the FVoiceRunnerThread trigger this to forward any captured audio bytes to the AudioWebSocket.

Member Function Documentation

◆ ConfigureSilenceThresholds()

void AudioCaptureHandler::ConfigureSilenceThresholds ( float micNoiseGateThreshold,
float silenceDetectionThreshold,
float micInputGain )

Configure values to help the microphone to pick up voice without background noise.

Parameters
micNoiseGateThresholdThe linear amplitude, anything below this will output silent audio data.
silenceDetectionThresholdThe linear amplitude, anything below this will not generate any audio data.
micInputGainThe linear amplitude muliplier applied to the input.

◆ GetDecibels()

float AudioCaptureHandler::GetDecibels ( ) const
Returns
The volume in decibels, of the last audioChunk (~30ms delay)

◆ GetDeviceName()

const FString & AudioCaptureHandler::GetDeviceName ( ) const
Returns
Returns the name of the device used by the VoiceModule, if initialized.

◆ IsInputSilent()

bool AudioCaptureHandler::IsInputSilent ( ) const
Returns
If the current input can be considered to be pure silence.

◆ RegisterSocket()

void AudioCaptureHandler::RegisterSocket ( TWeakPtr< AudioWebSocket > socket,
int bufferMillisecondSize )

Store a pointer to the websocket that will receive the parsed data from the FVoiceModule.

Parameters
socketA pointer to the websocket used for sending the microphone data.
bufferMillisecondSizeThe amount of milliseconds the buffer should account for.

◆ SetIsTestMode()

void AudioCaptureHandler::SetIsTestMode ( bool isTestMode)

◆ ShutDown()

void AudioCaptureHandler::ShutDown ( bool alsoDestroyCaptureDevice = false)

Stops the capture, permanently clearing the reserved memory for the background thread.

◆ StopCapture()

void AudioCaptureHandler::StopCapture ( )

Stop the voice capture, reset the buffers and stops the background thread.

◆ TryInitializeVoiceCapture()

bool AudioCaptureHandler::TryInitializeVoiceCapture ( int sampleRate = 16000,
int numChannels = 1 )

Tries to create a voice capture instance (IVoiceCapture).

Parameters
sampleRateThe sample rate that will be requested from the microphone, this must match the specification sent thought the websocket.
numChannelsThe amount of input channels that will be request from the microphone, this must match the specification sent thought the websocket.
Returns
True if VoiceCapture was created successfully.

◆ TryStartVoiceCapture()

bool AudioCaptureHandler::TryStartVoiceCapture ( )

Tries to start that IVoiceCapture and also start the background thread that will forward any captured data every fixed timestep.

Returns
True if the voice capture is started successfully.

Friends And Related Symbol Documentation

◆ FVoiceRunnerThread

friend class FVoiceRunnerThread
friend

The background thread needs access to our private functions.


The documentation for this class was generated from the following files: