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

#include <IAudioEndpoint.h>

Public Member Functions

virtual ~IAudioEndpoint ()
 
AUDIOEXTENSIONS_API Audio::FPatchInput PatchNewInput (float ExpectedDurationPerRender, float &OutSampleRate, int32 &OutNumChannels)
 
AUDIOEXTENSIONS_API void SetNewSettings (TUniquePtr< IAudioEndpointSettingsProxy > &&InNewSettings)
 
AUDIOEXTENSIONS_API void ProcessAudioIfNeccessary ()
 
virtual AUDIOEXTENSIONS_API bool IsImplemented ()
 

Protected Member Functions

virtual AUDIOEXTENSIONS_API float GetSampleRate () const
 
virtual AUDIOEXTENSIONS_API int32 GetNumChannels () const
 
virtual bool EndpointRequiresCallback () const
 
virtual int32 GetDesiredNumFrames () const
 
virtual bool OnAudioCallback (const TArrayView< const float > &InAudio, const int32 &NumChannels, const IAudioEndpointSettingsProxy *InSettings)
 
AUDIOEXTENSIONS_API int32 PopAudio (float *OutAudio, int32 NumSamples)
 
AUDIOEXTENSIONS_API void PollSettings (TFunctionRef< void(const IAudioEndpointSettingsProxy *)> NewSettingsRetrieved)
 
AUDIOEXTENSIONS_API void DisconnectAllInputs ()
 
AUDIOEXTENSIONS_API void StartRunningAsyncCallback ()
 
AUDIOEXTENSIONS_API void StopRunningAsyncCallback ()
 
AUDIOEXTENSIONS_API void RunCallbackSynchronously ()
 

Detailed Description

Class that allows audio to be sent to an arbitrary locale. This can be used for multi-device rendering, haptics systems, etc. Note that this only for interleaved audio buffers with no metadata for object-based or soundfield-based rendering. For those, see

Constructor & Destructor Documentation

◆ ~IAudioEndpoint()

virtual IAudioEndpoint::~IAudioEndpoint ( )
inlinevirtual

Member Function Documentation

◆ DisconnectAllInputs()

void IAudioEndpoint::DisconnectAllInputs ( )
protected

Thread safe function to disconnect everything from this endpoint. Anything that owns an Audio::FPatchInput will be notified and will have to call PatchNewInput() again to reconnect.

◆ EndpointRequiresCallback()

virtual bool IAudioEndpoint::EndpointRequiresCallback ( ) const
inlineprotectedvirtual

OPTIONAL OVERRIDES: For endpoints that do not explicitly fire a timed callback to poll audio data, this should be overridden to return true, and OnAudioCallback and GetDesiredNumFrames should be overridden.

◆ GetDesiredNumFrames()

virtual int32 IAudioEndpoint::GetDesiredNumFrames ( ) const
inlineprotectedvirtual

◆ GetNumChannels()

int32 IAudioEndpoint::GetNumChannels ( ) const
protectedvirtual

This should return the number of channels we should be sending to this endpoint. If the number of channels changes, please call DisconnectAllInputs.

◆ GetSampleRate()

float IAudioEndpoint::GetSampleRate ( ) const
protectedvirtual

REQUIRED OVERRIDES: This should return the sample rate we should be sending to this endpoint. If the sample rate changes, please call DisconnectAllInputs().

◆ IsImplemented()

bool IAudioEndpoint::IsImplemented ( )
virtual

Whether this endpoint is of an implemented type

◆ OnAudioCallback()

virtual bool IAudioEndpoint::OnAudioCallback ( const TArrayView< const float > &  InAudio,
const int32 NumChannels,
const IAudioEndpointSettingsProxy InSettings 
)
inlineprotectedvirtual

For endpoints that override EndpointRequiresCallback to return true, this callback will be called every (GetDesiredNumFrames() / GetSampleRate()) seconds.

Returns
whether the endpoint is still valid. If this returns false, DisconnectAllInputs will be called automatically.

◆ PatchNewInput()

Audio::FPatchInput IAudioEndpoint::PatchNewInput ( float  ExpectedDurationPerRender,
float OutSampleRate,
int32 OutNumChannels 
)

Create a new patch point for this endpoint. Please see MultithreadedPatching.h to see how to use the FPatchInput class.

Parameters
[in]ExpectedDurationPerRenderThe worst-case amount of time expected between render callbacks. This is used to determined how much to allocate for this input.
[out]OutSampleRate.The sample rate expected to be pushed to the returned FPatchInput. If you need to resample your input, please see Audio::FResampler.
[out]OutNumChannels.The number of channels expected to be pushed to the returned FPatchInput. If you need to downmix or upmix your input, try using the following: TArray<float> MixdownGainsMap; Audio::FMixerDevice::Get2DChannelMap(false, NumInputChannels, NumOutputChannels, false, MixdownGainsMap); Audio::DownmixBuffer(NumInputChannels, NumOutputChannels, InputAudio, OutputAudio, MixdownGainsMap.GetData());
Returns
a new Audio::FPatchInput. The FPatchInput may be disconnected if this endpoint's sample rate or channel count changes, in which case you will need to reconnect by calling this again.

◆ PollSettings()

void IAudioEndpoint::PollSettings ( TFunctionRef< void(const IAudioEndpointSettingsProxy *)>  NewSettingsRetrieved)
protected

Use this as a thread safe way to use the current settings posted to this IAudioEndpoint. Locks with IAudioEndpoint::SetSettings.

Parameters
[in]NewSettingsRetrievedlambda used to work with the retrieved settings. This lambda is called immediately and synchronously, but is used to safely scope usage of the IAudioEndpointSettingsProxy pointer.

◆ PopAudio()

int32 IAudioEndpoint::PopAudio ( float OutAudio,
int32  NumSamples 
)
protected

METHODS USED BY IMPLEMENTATIONS OF IAudioEndpoint: This is used by the IAudioEndpoint implementation to poll buffered audio to process or send to the endpoint. Note that this is NOT thread safe if EndpointRequiresCallback() is overridden to return true. If that is the case, use an override of OnAudioCallback instead.

Parameters
[in]OutAudioPointer to already allocated buffer of floats, at least NumSamples long. This will be filled with interleaved audio based on GetNumChannels().
[in]NumSamplesThe number of samples to fill OutAudio with.
Returns
[out] the number of samples polled from this thing.

◆ ProcessAudioIfNeccessary()

void IAudioEndpoint::ProcessAudioIfNeccessary ( )

If this audio endpoint hasn't spawned a seperate callback thread but requires a callback, this should be executed somewhere.

◆ RunCallbackSynchronously()

void IAudioEndpoint::RunCallbackSynchronously ( )
protected

If EndpointRequiresCallback() returns true, this can be used to manually run the callback.

◆ SetNewSettings()

void IAudioEndpoint::SetNewSettings ( TUniquePtr< IAudioEndpointSettingsProxy > &&  InNewSettings)

Post new settings for this endpoint. There is no type safety on this call, so make sure that you are using the correct implementation of IAudioEndpointSettingsProxy for this implementation of IAudioEndpoint.

◆ StartRunningAsyncCallback()

void IAudioEndpoint::StartRunningAsyncCallback ( )
protected

If EndpointRequiresCallback() returns true, this can be used to spawn an async thread and begin calling OnAudioCallback.

◆ StopRunningAsyncCallback()

void IAudioEndpoint::StopRunningAsyncCallback ( )
protected

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