FAsyncSpectrumAnalyzer

SpectrumAnalyzer for computing spectrum in async task.

Choose your operating system:

Windows

macOS

Linux

References

Module

SignalProcessing

Header

/Engine/Source/Runtime/SignalProcessing/Public/DSP/SpectrumAnalyzer.h

Include

#include "DSP/SpectrumAnalyzer.h"

Syntax

class FAsyncSpectrumAnalyzer

Remarks

SpectrumAnalyzer for computing spectrum in async task.

Constructors

Name Description

Public function

FAsyncSpectrumAnalyzer()

Public function

FAsyncSpectrumAnalyzer

(
    float InSampleRate
)

If an instance is created using either of these constructors, Init() is not neccessary.

Public function

FAsyncSpectrumAnalyzer

(
    const FSpectrumAnalyzerSettings& I...,
    float InSampleRate
)

Destructors

Name Description

Public function Virtual

~FAsyncSpectrumAnalyzer()

Functions

Name Description

Public function

void

 

GetBands

(
    ISpectrumBandExtractor& InExtracto...,
    TArray< float >& OutValues
)

Return array of bands using spectrum band extractor.

Public function

float

 

GetMagnitudeForFrequency

(
    float InFrequency,
    FSpectrumAnalyzer::EPeakInterpolati...
)

Samples magnitude (linearly) for a given frequency, in Hz.

Public function

float

 

GetNormalizedMagnitudeForFrequency

(
    float InFrequency,
    FSpectrumAnalyzer::EPeakInterpolati...
)

Public function

float

 

GetPhaseForFrequency

(
    float InFrequency,
    FSpectrumAnalyzer::EPeakInterpolati...
)

Samples phase for a given frequency, in Hz.

Public function

void

 

GetSettings

(
    FSpectrumAnalyzerSettings& OutSett...
)

Get the current settings used by this Spectrum Analyzer.

Public function

void

 

Init

(
    const FSpectrumAnalyzerSettings& I...,
    float InSampleRate
)

Initialize sample rate of analyzer if not known at time of construction.

Public function

void

 

Init

(
    float InSampleRate
)

Initialize sample rate of analyzer if not known at time of construction.

Public function

bool

 

IsInitialized()

Returns false if this instance of FSpectrumAnalyzer was constructed with the default constructor and Init() has not been called yet.

Public function

void

 

LockOutputBuffer()

You can call this function to ensure that you're sampling the same window of frequency data, Then call UnlockOutputBuffer when you're done.

Public function

bool

 

PerformAnalysisIfPossible

(
    bool bUseLatestAudio
)

Thread safe call to perform actual FFT.

Public function

bool

 

PerformAsyncAnalysisIfPossible

(
    bool bUseLatestAudio
)

Thread safe call to perform actual FFT.

Public function

bool

 

PushAudio

(
    const TSampleBuffer< float >& InBu...
)

Push audio to queue. Returns false if the queue is already full.

Public function

bool

 

PushAudio

(
    const float* InBuffer,
    int32 NumSamples
)

Push audio to queue. Returns false if the queue is already full.

Public function

void

 

SetSettings

(
    const FSpectrumAnalyzerSettings& I...
)

Update the settings used by this Spectrum Analyzer. Safe to call on any thread, but should not be called every tick.

Public function

void

 

UnlockOutputBuffer()