UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Audio::FWasapiStreamManager Class Reference

#include <WasapiStreamManager.h>

Public Types

using FDeviceInfo = FWasapiDeviceEnumeration::FDeviceInfo
 

Public Member Functions

 FWasapiStreamManager ()
 
 FWasapiStreamManager (FWasapiStreamManager &&InOther)=delete
 
 FWasapiStreamManager (const FWasapiStreamManager &InOther)=delete
 
virtual ~FWasapiStreamManager ()
 
FWasapiStreamManageroperator= (FWasapiStreamManager &&InOther)=delete
 
FWasapiStreamManageroperator= (const FWasapiStreamManager &InOther)=delete
 
FString GetDefaultInputDeviceId ()
 
FString GetDefaultOutputDeviceId ()
 
bool GetDeviceInfo (const FString &InDeviceId, FDeviceInfo &OutDeviceInfo)
 
bool GetDeviceIndexFromId (const FString &InDeviceId, int32 &OutDeviceIndex)
 
bool GetDeviceIdFromIndex (int32 InDeviceIndex, EDataFlow InDataFlow, FString &OutDeviceId)
 
bool GetInputDevicesAvailable (TArray< FDeviceInfo > &OutDevices)
 
bool OpenStream (const FString &InDeviceId, const FWasapiAudioFormat &InFormat, uint32 InNumFramesDesired, FWasapiOnAudioCaptureFunction InCallback)
 
bool IsStreamOpen () const
 
void StartStream ()
 
bool IsCapturing () const
 
void StopStream ()
 
void AbortStream ()
 
void CloseStream ()
 
uint32 GetStreamBufferSizeBytes () const
 
double GetStreamPosition () const
 

Detailed Description

FWasapiStreamManager - Top level object for managing audio captures. It is composed of a device enumerator, capture thread, input stream and state machine. In the future, additional input streams may be managed here in support of multi-track capture.

Member Typedef Documentation

◆ FDeviceInfo

Constructor & Destructor Documentation

◆ FWasapiStreamManager() [1/3]

Audio::FWasapiStreamManager::FWasapiStreamManager ( )

◆ FWasapiStreamManager() [2/3]

Audio::FWasapiStreamManager::FWasapiStreamManager ( FWasapiStreamManager &&  InOther)
delete

◆ FWasapiStreamManager() [3/3]

Audio::FWasapiStreamManager::FWasapiStreamManager ( const FWasapiStreamManager InOther)
delete

◆ ~FWasapiStreamManager()

virtual Audio::FWasapiStreamManager::~FWasapiStreamManager ( )
inlinevirtual

Member Function Documentation

◆ AbortStream()

void Audio::FWasapiStreamManager::AbortStream ( )

Brute force stops the capture thread.

◆ CloseStream()

void Audio::FWasapiStreamManager::CloseStream ( )

Releases resources related to the capture thread and input streams.

◆ GetDefaultInputDeviceId()

FString Audio::FWasapiStreamManager::GetDefaultInputDeviceId ( )

Returns the default input device Id.

◆ GetDefaultOutputDeviceId()

FString Audio::FWasapiStreamManager::GetDefaultOutputDeviceId ( )

Returns the default output device Id.

◆ GetDeviceIdFromIndex()

bool Audio::FWasapiStreamManager::GetDeviceIdFromIndex ( int32  InDeviceIndex,
EDataFlow  InDataFlow,
FString &  OutDeviceId 
)

GetDeviceIdFromIndex - Convienence method for FWasapiDeviceEnumeration::GetDeviceIdFromIndex()

◆ GetDeviceIndexFromId()

bool Audio::FWasapiStreamManager::GetDeviceIndexFromId ( const FString &  InDeviceId,
int32 OutDeviceIndex 
)

GetDeviceIndexFromId - Convienence method for FWasapiDeviceEnumeration::GetDeviceIndexFromId()

◆ GetDeviceInfo()

bool Audio::FWasapiStreamManager::GetDeviceInfo ( const FString &  InDeviceId,
FDeviceInfo OutDeviceInfo 
)

GetDeviceInfo - Convienence method for FWasapiDeviceEnumeration::GetDeviceInfo()

◆ GetInputDevicesAvailable()

bool Audio::FWasapiStreamManager::GetInputDevicesAvailable ( TArray< FDeviceInfo > &  OutDevices)

GetInputDevicesAvailable - Convienence method for FWasapiDeviceEnumeration::GetInputDevicesAvailable()

◆ GetStreamBufferSizeBytes()

uint32 Audio::FWasapiStreamManager::GetStreamBufferSizeBytes ( ) const

Returns the buffer size in bytes of the callback buffer.

◆ GetStreamPosition()

double Audio::FWasapiStreamManager::GetStreamPosition ( ) const

Returns the current position (in seconds) of the input stream.

◆ IsCapturing()

bool Audio::FWasapiStreamManager::IsCapturing ( ) const

Indicates if the stream was successfully started and is capturing data.

◆ IsStreamOpen()

bool Audio::FWasapiStreamManager::IsStreamOpen ( ) const

Returns whether or not this object has been successfully initialized.

◆ OpenStream()

bool Audio::FWasapiStreamManager::OpenStream ( const FString &  InDeviceId,
const FWasapiAudioFormat InFormat,
uint32  InNumFramesDesired,
FWasapiOnAudioCaptureFunction  InCallback 
)

OpenStream - Finds the device for the given Id and prepares it for capturing audio. It also spawns a capture thread.

Parameters
InDeviceId- Id of the device to use for capturing audio.
InFormat- The audio format to use for the capture.
InNumFramesDesired- The number of audio frames desired when audio is delivered via the capture callback.
InCallback- The callback which is called periodically during capture with audio data.

◆ operator=() [1/2]

FWasapiStreamManager & Audio::FWasapiStreamManager::operator= ( const FWasapiStreamManager InOther)
delete

◆ operator=() [2/2]

FWasapiStreamManager & Audio::FWasapiStreamManager::operator= ( FWasapiStreamManager &&  InOther)
delete

◆ StartStream()

void Audio::FWasapiStreamManager::StartStream ( )

Starts the audio capture which triggers periodic callbacks with new audio data.

◆ StopStream()

void Audio::FWasapiStreamManager::StopStream ( )

Stops the capture thread which, in turn, completes the runnable and stops the input stream.


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