AudioCaptureHandler.
More...
#include <AudioCaptureHandler.h>
|
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) |
|
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.
◆ ConfigureSilenceThresholds()
void AudioCaptureHandler::ConfigureSilenceThresholds |
( |
float | micNoiseGateThreshold, |
|
|
float | silenceDetectionThreshold, |
|
|
float | micInputGain ) |
Configure values to help the microphone to pick up voice without background noise.
- Parameters
-
micNoiseGateThreshold | The linear amplitude, anything below this will output silent audio data. |
silenceDetectionThreshold | The linear amplitude, anything below this will not generate any audio data. |
micInputGain | The 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
-
socket | A pointer to the websocket used for sending the microphone data. |
bufferMillisecondSize | The 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
-
sampleRate | The sample rate that will be requested from the microphone, this must match the specification sent thought the websocket. |
numChannels | The 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.
◆ FVoiceRunnerThread
The background thread needs access to our private functions.
The documentation for this class was generated from the following files: