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

#include <RuntimeResampler.h>

Public Member Functions

UE_API FRuntimeResampler (int32 InNumChannels)
 
UE_API void SetFrameRatio (float InRatio, int32 InNumFramesToInterpolate=0)
 
UE_API int32 GetNumInputFramesNeededToProduceOutputFrames (int32 InNumOutputFrames) const
 
UE_API int32 GetNumOutputFramesProducedByInputFrames (int32 InNumInputFrames) const
 
UE_API int32 ProcessCircularBuffer (FMultichannelCircularBuffer &InAudio, FMultichannelBuffer &OutAudio)
 
UE_API int32 ProcessCircularBuffer (FMultichannelCircularBuffer &InAudio, FMultichannelBufferView &OutAudio)
 
UE_API void ProcessInterleaved (TArrayView< const float > Input, TArrayView< float > Output, int32 &OutNumInputFramesConsumed, int32 &OutNumOutputFramesProduced)
 
UE_API void Reset (int32 InNumChannels)
 

Static Public Attributes

static UE_API const float MaxFrameRatio = 100.f
 
static UE_API const float MinFrameRatio = 0.01f
 

Detailed Description

Linear interpolating resampler which supports any number of channels of audio, interleaved or deinterleaved. To support different types of input and output objects, add a new "Process..." method which wraps around calls to ProcessAudioInternal().

Constructor & Destructor Documentation

◆ FRuntimeResampler()

Audio::FRuntimeResampler::FRuntimeResampler ( int32  InNumChannels)

Construct a linear resampler.

Parameters
InNumChannel- Number of audio channels in input and output buffers.

Member Function Documentation

◆ GetNumInputFramesNeededToProduceOutputFrames()

int32 Audio::FRuntimeResampler::GetNumInputFramesNeededToProduceOutputFrames ( int32  InNumOutputFrames) const

Returns the minimum number of input frames needed to produce the desired number of output frames given the current state of the resampler.

Parameters
InNumOutputFrames- The desired number of output frames.
Returns
The minimum number of input frames.

◆ GetNumOutputFramesProducedByInputFrames()

int32 Audio::FRuntimeResampler::GetNumOutputFramesProducedByInputFrames ( int32  InNumInputFrames) const

Returns the maximum number of output frames that can be produced from the provided number of input frames given the current state of the resampler.

Parameters
InNumInputFrames- The number of provided input frames.
Returns
The maximum number of output frames.

◆ ProcessCircularBuffer() [1/2]

int32 Audio::FRuntimeResampler::ProcessCircularBuffer ( FMultichannelCircularBuffer InAudio,
FMultichannelBuffer OutAudio 
)

Consumes audio from the input buffer and produces audio in the output buffer. The desired number of frames to produce is determined by the output audio buffer size. For the desired number of samples to be produced, the input audio must have the minimum number of frames needed to produce the output frames (see GetNumInputFramesNeededToProduceOutputFrames(...)). Input samples which are no longer needed are removed from the input buffer.

Parameters
InAudio- Multichannel circular buffer of input audio.
OutAudio- Multichannel buffer of output audio. FMultichannelBuffer
Returns
Actual number of frames produced.

◆ ProcessCircularBuffer() [2/2]

int32 Audio::FRuntimeResampler::ProcessCircularBuffer ( FMultichannelCircularBuffer InAudio,
FMultichannelBufferView OutAudio 
)

Consumes audio from the input buffer and produces audio in the output buffer. The desired number of frames to produce is determined by the output audio buffer size. For the desired number of samples to be produced, the input audio must have the minimum number of frames needed to produce the output frames (see GetNumInputFramesNeededToProduceOutputFrames(...)). Input samples which are no longer needed are removed from the input buffer.

Parameters
InAudio- Multichannel circular buffer of input audio.
OutAudio- Multichannel buffer of output audio. FMultichannelBuffer
Returns
Actual number of frames produced.

◆ ProcessInterleaved()

void Audio::FRuntimeResampler::ProcessInterleaved ( TArrayView< const float Input,
TArrayView< float Output,
int32 OutNumInputFramesConsumed,
int32 OutNumOutputFramesProduced 
)

Consumes audio in an interleaved channel format from the input buffer and produces audio in the output buffer. The desired number of frames to produce is determined by the output audio buffer size. For the desired number of samples to be produced, the input audio must have the minimum number of frames needed to produce the output frames (see GetNumInputFramesNeededToProduceOutputFrames(...)).

Parameters
InAudio- Multichannel interleaved audio to use as input.
OutAudio- Buffer to receive multichannel interleaved output audio.
OutNumInputFramesConsumed- Receives the actual number of frames of input consumed.
OutNumOutputFramesProduced- Receives the actual number of frames of output produced.

◆ Reset()

void Audio::FRuntimeResampler::Reset ( int32  InNumChannels)

Reset the internal state of the resampler. Call this if the next audio data to be submitted is unrelated to the audio that has been submitted previously.

◆ SetFrameRatio()

void Audio::FRuntimeResampler::SetFrameRatio ( float  InRatio,
int32  InNumFramesToInterpolate = 0 
)

Sets the number of input frames to read per an output frame. 0.5 is half speed, 1.f is normal speed, 2.0 is double speed.

Parameters
InRatio- Ratio of input frames consumed per an output frame produced.
InNumFramesToInterpolate- Number of output frames over which to interpolate the frame ratio.

Member Data Documentation

◆ MaxFrameRatio

const float Audio::FRuntimeResampler::MaxFrameRatio = 100.f
static

◆ MinFrameRatio

const float Audio::FRuntimeResampler::MinFrameRatio = 0.01f
static

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