TSampleBuffer

TSampleBuffer This class owns an audio buffer.

Windows
MacOS
Linux

References

Module

SignalProcessing

Header

/Engine/Source/Runtime/SignalProcessing/Public/SampleBuffer.h

Include

#include "SampleBuffer.h"

Syntax

template<class SampleType>
class TSampleBuffer

Remarks

TSampleBuffer<class SampleType> This class owns an audio buffer. To convert between fixed Q15 buffers and float buffers, Use the assignment operator. Example: TSampleBuffer<float> AFloatBuffer; TSampleBuffer<int16> AnIntBuffer = AFloatBuffer;

Constructors

Name Description

Public function

TSampleBuffer()

Public function

TSampleBuffer

(
    const TSampleBuffer& Other
)

Public function

TSampleBuffer

(
    const AlignedFloatBuffer& InData,
    int32 InNumChannels,
    int32 InSampleRate
)

Public function

TSampleBuffer

(
    const float* InBufferPtr,
    int32 InNumSamples,
    int32 InNumChannels,
    int32 InSampleRate
)

Public function

TSampleBuffer

(
    const int16* InBufferPtr,
    int32 InNumSamples,
    int32 InNumChannels,
    int32 InSampleRate
)

Destructors

Name Description

Public function

~TSampleBuffer()

Functions

Name Description

Public function

void

 

Append

(
    const OtherSampleType* InputBu...,
    int32 InNumSamples
)

Append audio data to internal buffer of different sample type of this sample buffer.

Public function

void

 

Append

(
    const OtherSampleType* InputBu...,
    int32 InNumSamples,
    int32 InNumChannels,
    int32 InSampleRate
)

Overload of Append that also sets the number of channels and sample rate.

Public function

void

 

Clamp

(
    float Ceiling
)

Public function

void

 

CopyFrom

(
    const TArray< SampleType >& InArra...,
    int32 InNumChannels,
    int32 InSampleRate
)

Copy from a container of the same element type

Public function Const

TArrayView< ...

 

GetArrayView()

Public function

TArrayView< ...

 

GetArrayView()

Public function Const

float

 

GetAudioFrameAtFractionalIndex

(
    float InIndex,
    TArray< SampleType >& OutFrame
)

InIndex [0.0f, NumSamples - 1.0f] OutFrame is the multichannel output for one index value Returns InIndex wrapped between 0.0 and NumFrames

Public function Const

float

 

GetAudioFrameAtPhase

(
    float InPhase,
    TArray< SampleType >& OutFrame
)

InPhase [0, 1], wrapped, through duration of file (ignores sample rate) OutFrame is the multichannel output for one phase value Returns InPhase wrapped between 0.0 and 1.0

Public function Const

float

 

GetAudioFrameAtTime

(
    float InTimeSec,
    TArray< SampleType >& OutFrame
)

InTimeSec, get the value of the buffer at the given time (uses sample rate) OutFrame is the multichannel output for one time value Returns InTimeSec wrapped between 0.0 and (NumSamples / SampleRate)

Public function Const

const Sample...

 

GetData()

Gets the raw PCM data of the sound wave.

Public function Const

int32

 

GetNumChannels()

Gets the number of channels of the sound wave.

Public function Const

int32

 

GetNumFrames()

Gets the number of frames of the sound wave.

Public function Const

int32

 

GetNumSamples()

Gets the number of samples of the sound wave.

Public function Const

float

 

GetSampleDuration()

Public function Const

int32

 

GetSampleRate()

Gets the sample rate of the sound wave.

Public function

void

 

MixBufferToChannels

(
    int32 InNumChannels
)

Public function

void

 

Reset()

Public function

void

 

SetNumFrames

(
    int32 InNumFrames
)

Public function

void

 

ZeroPad

(
    int32 NumFramesToAppend
)

Appends zeroes to the end of this buffer.

Operators

Name Description

Public function

TSampleBuffe...

 

operator=

(
    const TSampleBuffer< OtherSampleTyp...
)

SampleType converting assignment operator:

Public function

TSampleBuffe...

 

operator=

(
    const TSampleBuffer& Other
)

Vanilla assignment operator:

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss