32 TObjectPtr<UFFTConfig> InFFTConfig,
68 virtual bool Init()
override;
71 virtual uint32
Run()
override;
74 virtual void Stop()
override;
77 virtual void Exit()
override;
84 void Compute_FrequencyBands(uint32 ChannelIndex);
87 void Compute_Amplitude(uint32 ChannelIndex);
90 void Compute_Pitch(uint32 ChannelIndex);
93 void Compute_Beat(uint32 ChannelIndex);
101 float PerformChecksum(
const float* buffer, uint32 size);
108 void Filter(
FFFTFilterConfig InFilterConfig, TArray<float>& FilteredMagnitudes, uint32 ChannelIndex);
111 void Filter_Butterworth(
FFFTFilterConfig InFilterConfig, TArray<float>& FilteredMagnitudes, uint32 ChannelIndex);
114 void Filter_ChebyshevTypeI(
FFFTFilterConfig InFilterConfig, TArray<float>& FilteredMagnitudes, uint32 ChannelIndex);
117 bool Windowing_Hann(uint32 ChannelIndex);
120 bool Windowing_Hamming(uint32 ChannelIndex);
123 bool Windowing_BlackmanHarris(uint32 ChannelIndex);
126 bool Windowing_Gaussian(uint32 ChannelIndex);
129 void SpectrumSpacing_Log();
132 void SpectrumSpacing_OctaveSubdivision();
135 void SpectrumSpacing_Linear();
138 void SpectrumSpacing_Quadratic();
142 TUniquePtr<FRunnableThread> Thread =
nullptr;
145 FEvent* m_semaphore =
nullptr;
148 FThreadSafeBool m_Kill;
151 FThreadSafeBool m_Pause;
157 FCriticalSection FFTLock;
163 TObjectPtr<UFFTConfig> FFTConfig =
nullptr;
166 TFunction<void(
const TArray<float>&)> m_OnProcessedAudioReady;
170 kiss_fft_cpx* fftOutputBuffer =
nullptr;
173 kiss_fftr_cfg cfg = NULL;
177 TArray<float> RawMagnitudes;
180 TArray<float> RawMagnitudesHistory;
183 TArray<float> FrequencyBandsHistory;
186 TArray<float> FrequencyBands;
189 TArray<float> FrequencyBandEdges;
192 TArray<uint32> FrequencyBinsByBand;
195 TArray<float> AmplitudeHistory;
198 TArray<float> PitchHistory;
201 TArray<float> BeatHistory;
204 TArray<float> BeatRawMagnitudes;
207 TArray<FChannelBeatDetection> BeatDetectionForChannel;
210 TArray<bool> ProcessedChannel;
216 TArray<float*> PaddedFFTInputBuffer;
219 TArray<float> LastBufferChecksum;
222 uint32 ChannelMultiplier = 1;
225 TArray<FDetectionBeat> DetectedBeats;
228 int32 BeatSkipCount = 0;
FST_FFTThread(FString InName, FFFTIOData InFFTIOData, TObjectPtr< UFFTConfig > InFFTConfig, class UST_AudioIOBase *InAnalyserBase)
Constructor.
Definition ST_FFTThread.cpp:16
virtual bool Init() override
Initialize the thread. Called once before Run().
Definition ST_FFTThread.cpp:81
virtual uint32 Run() override
Main loop where work is performed.
Definition ST_FFTThread.cpp:186