UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IVoiceCapture Class Referenceabstract

#include <VoiceCapture.h>

+ Inheritance diagram for IVoiceCapture:

Public Member Functions

virtual ~IVoiceCapture ()
 
virtual bool Init (const FString &DeviceName, int32 SampleRate, int32 NumChannels)=0
 
virtual void Shutdown ()=0
 
virtual bool Start ()=0
 
virtual void Stop ()=0
 
virtual bool ChangeDevice (const FString &DeviceName, int32 SampleRate, int32 NumChannels)=0
 
virtual bool IsCapturing ()=0
 
virtual EVoiceCaptureState::Type GetCaptureState (uint32 &OutAvailableVoiceData) const =0
 
virtual EVoiceCaptureState::Type GetVoiceData (uint8 *OutVoiceBuffer, uint32 InVoiceBufferSize, uint32 &OutAvailableVoiceData)
 
virtual EVoiceCaptureState::Type GetVoiceData (uint8 *OutVoiceBuffer, uint32 InVoiceBufferSize, uint32 &OutAvailableVoiceData, uint64 &OutSampleCounter)
 
virtual int32 GetBufferSize () const =0
 
virtual void DumpState () const =0
 
Audio::FPatchOutputStrongPtr GetMicrophoneAudio (int32 MaxExpectedLatencyInSamples, float Gain)
 
virtual float GetCurrentAmplitude () const
 
- Public Member Functions inherited from TSharedFromThis< IVoiceCapture >
TSharedRef< IVoiceCapture, Mode > AsShared ()
 
TSharedRef< IVoiceCapture const, Mode > AsShared () const
 
TSharedRef< SubobjectType, Mode > AsSharedSubobject (SubobjectType *SubobjectPtr) const
 
TWeakPtr< IVoiceCapture, Mode > AsWeak ()
 
TWeakPtr< IVoiceCapture const, Mode > AsWeak () const
 
TWeakPtr< SubobjectType, Mode > AsWeakSubobject (SubobjectType *SubobjectPtr) const
 
void UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, SharedPtrMode > const *InSharedPtr, OtherType *InObject) const
 
void UpdateWeakReferenceInternal (TSharedRef< SharedRefType, SharedPtrMode > const *InSharedRef, OtherType *InObject) const
 
UE_FORCEINLINE_HINT bool DoesSharedInstanceExist () const
 

Protected Member Functions

 IVoiceCapture ()
 
- Protected Member Functions inherited from TSharedFromThis< IVoiceCapture >
 TSharedFromThis ()
 
 TSharedFromThis (TSharedFromThis const &)
 
UE_FORCEINLINE_HINT TSharedFromThisoperator= (TSharedFromThis const &)
 
 ~TSharedFromThis ()
 

Protected Attributes

Audio::FPatchSplitter MicrophoneOutput
 

Additional Inherited Members

- Static Protected Member Functions inherited from TSharedFromThis< IVoiceCapture >
static UE_FORCEINLINE_HINT TSharedRef< OtherType, Mode > SharedThis (OtherType *ThisPtr)
 
static UE_FORCEINLINE_HINT TSharedRef< OtherType const, Mode > SharedThis (const OtherType *ThisPtr)
 

Detailed Description

Interface for capturing voice data on any platform

Constructor & Destructor Documentation

◆ IVoiceCapture()

IVoiceCapture::IVoiceCapture ( )
inlineprotected

◆ ~IVoiceCapture()

virtual IVoiceCapture::~IVoiceCapture ( )
inlinevirtual

Member Function Documentation

◆ ChangeDevice()

virtual bool IVoiceCapture::ChangeDevice ( const FString &  DeviceName,
int32  SampleRate,
int32  NumChannels 
)
pure virtual

Change the associated capture device

Parameters
DeviceNamename of device to capture audio data with, empty for default device
SampleRatesampling rate of voice capture
NumChannelsnumber of channels to capture
Returns
true if change was successful, false otherwise

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ DumpState()

virtual void IVoiceCapture::DumpState ( ) const
pure virtual

Dump the state of the voice capture device

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ GetBufferSize()

virtual int32 IVoiceCapture::GetBufferSize ( ) const
pure virtual
Returns
number of bytes currently allocated in the capture buffer

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ GetCaptureState()

virtual EVoiceCaptureState::Type IVoiceCapture::GetCaptureState ( uint32 OutAvailableVoiceData) const
pure virtual

Return the state of the voice data and its availability

Parameters
OutAvailableVoiceDatasize, in bytes, of available voice data
Returns
state of the voice capture buffer

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ GetCurrentAmplitude()

virtual float IVoiceCapture::GetCurrentAmplitude ( ) const
inlinevirtual
Returns
the current loudness of the microphone. Returns -1.0 if this function is not supported by the current platform.

Reimplemented in FVoiceCaptureWindows.

◆ GetMicrophoneAudio()

Audio::FPatchOutputStrongPtr IVoiceCapture::GetMicrophoneAudio ( int32  MaxExpectedLatencyInSamples,
float  Gain 
)
inline
Returns
a new output for this mic's audio.

◆ GetVoiceData() [1/2]

virtual EVoiceCaptureState::Type IVoiceCapture::GetVoiceData ( uint8 OutVoiceBuffer,
uint32  InVoiceBufferSize,
uint32 OutAvailableVoiceData 
)
inlinevirtual

Fill a buffer with all available voice data

Parameters
OutVoiceBufferallocated buffer to fill with voice data
InVoiceBufferSizesize, in bytes, of allocated buffer
OutAvailableVoiceDatasize, in bytes, of data placed in the OutVoiceBuffer
OutSampleCounteroptional parameter for beginning sample of this buffer.
Returns
state of the voice capture buffer

Reimplemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ GetVoiceData() [2/2]

virtual EVoiceCaptureState::Type IVoiceCapture::GetVoiceData ( uint8 OutVoiceBuffer,
uint32  InVoiceBufferSize,
uint32 OutAvailableVoiceData,
uint64 OutSampleCounter 
)
inlinevirtual

Reimplemented in FVoiceCaptureWindows.

◆ Init()

virtual bool IVoiceCapture::Init ( const FString &  DeviceName,
int32  SampleRate,
int32  NumChannels 
)
pure virtual

Initialize the voice capture object

Parameters
DeviceNamename of device to capture audio data with, empty for default device
SampleRatesampling rate of voice capture
NumChannelsnumber of channels to capture
Returns
true if successful, false otherwise

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ IsCapturing()

virtual bool IVoiceCapture::IsCapturing ( )
pure virtual

Is the voice capture object actively capturing

Returns
true if voice is being captured, false otherwise

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ Shutdown()

virtual void IVoiceCapture::Shutdown ( )
pure virtual

Shutdown the voice capture object

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ Start()

virtual bool IVoiceCapture::Start ( )
pure virtual

Start capturing voice

Returns
true if successfully started, false otherwise

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

◆ Stop()

virtual void IVoiceCapture::Stop ( )
pure virtual

Stop capturing voice

Implemented in FVoiceCaptureOpenSLES, FVoiceCaptureCoreAudio, and FVoiceCaptureWindows.

Member Data Documentation

◆ MicrophoneOutput

Audio::FPatchSplitter IVoiceCapture::MicrophoneOutput
protected

Optional patch point for MicrophoneOutput.


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