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

#include <MultichannelLinearResampler.h>

Public Member Functions

SIGNALPROCESSING_API FMultichannelLinearResampler (int32 InNumChannels)
 
SIGNALPROCESSING_API void SetFrameRatio (float InRatio, int32 InNumFramesToInterpolate=0)
 
SIGNALPROCESSING_API float MapInputFrameToOutputFrame (float InInputFrameIndex) const
 
SIGNALPROCESSING_API float MapOutputFrameToInputFrame (float InOutputFrameIndex) const
 
SIGNALPROCESSING_API int32 GetNumInputFramesNeededToProduceOutputFrames (int32 InNumOutputFrames) const
 
SIGNALPROCESSING_API int32 ProcessAndConsumeAudio (FMultichannelCircularBuffer &InAudio, FMultichannelBuffer &OutAudio)
 
SIGNALPROCESSING_API int32 ProcessAndConsumeAudio (FMultichannelCircularBuffer &InAudio, FMultichannelBufferView &OutAudio)
 

Static Public Attributes

static SIGNALPROCESSING_API const float MaxFrameRatio = 100.f
 
static SIGNALPROCESSING_API const float MinFrameRatio = 0.001f
 

Detailed Description

Linear resampler working on multichannel buffers

Constructor & Destructor Documentation

◆ FMultichannelLinearResampler()

Audio::FMultichannelLinearResampler::FMultichannelLinearResampler ( int32  InNumChannels)

Construct a linear resampler.

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

Member Function Documentation

◆ GetNumInputFramesNeededToProduceOutputFrames()

int32 Audio::FMultichannelLinearResampler::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.

◆ MapInputFrameToOutputFrame()

float Audio::FMultichannelLinearResampler::MapInputFrameToOutputFrame ( float  InInputFrameIndex) const

Translates an input frame index to an output frame index given the state of the resampler.

Note: Indices are relative to the buffers passed to ProcessAudio(...). The resampler does not maintain a sample counter between calls to ProcessAudio(...).

Parameters
InInputFrameIndex- Index of input frame.
Returns
Index of output frame.

◆ MapOutputFrameToInputFrame()

float Audio::FMultichannelLinearResampler::MapOutputFrameToInputFrame ( float  InOutputFrameIndex) const

Translates an output frame index to an input frame index given the state of the resampler.

Note: Indices are relative to the buffers passed to ProcessAudio(...). The resampler does not maintain a sample counter between calls to ProcessAudio(...).

Parameters
InOutputFrameIndex- Index of output frame.
Returns
Index of input frame.

◆ ProcessAndConsumeAudio() [1/2]

int32 Audio::FMultichannelLinearResampler::ProcessAndConsumeAudio ( 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.
Returns
Actual number of frames produced.

◆ ProcessAndConsumeAudio() [2/2]

int32 Audio::FMultichannelLinearResampler::ProcessAndConsumeAudio ( FMultichannelCircularBuffer InAudio,
FMultichannelBufferView OutAudio 
)

◆ SetFrameRatio()

void Audio::FMultichannelLinearResampler::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::FMultichannelLinearResampler::MaxFrameRatio = 100.f
static

◆ MinFrameRatio

const float Audio::FMultichannelLinearResampler::MinFrameRatio = 0.001f
static

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