32 TObjectPtr<UFFTConfig> InFFTConfig,
71 virtual bool Init()
override;
74 virtual uint32
Run()
override;
77 virtual void Stop()
override;
80 virtual void Exit()
override;
87 void Compute_FrequencyBands(uint32 ChannelIndex);
90 void Compute_Amplitude(uint32 ChannelIndex);
93 void Compute_Pitch(uint32 ChannelIndex);
96 void Compute_Beat(uint32 ChannelIndex);
104 float PerformChecksum(
const float* buffer, uint32 size);
111 void Filter(
FFFTFilterConfig InFilterConfig, TArray<float>& FilteredMagnitudes, uint32 ChannelIndex);
114 void Filter_Butterworth(
FFFTFilterConfig InFilterConfig, TArray<float>& FilteredMagnitudes, uint32 ChannelIndex);
117 void Filter_ChebyshevTypeI(
FFFTFilterConfig InFilterConfig, TArray<float>& FilteredMagnitudes, uint32 ChannelIndex);
120 bool Windowing_Hann(uint32 ChannelIndex);
123 bool Windowing_Hamming(uint32 ChannelIndex);
126 bool Windowing_BlackmanHarris(uint32 ChannelIndex);
129 bool Windowing_Gaussian(uint32 ChannelIndex);
132 void SpectrumSpacing_Log();
135 void SpectrumSpacing_OctaveSubdivision();
138 void SpectrumSpacing_Linear();
141 void SpectrumSpacing_Quadratic();
145 TUniquePtr<FRunnableThread> Thread =
nullptr;
148 FEvent* m_semaphore =
nullptr;
151 FThreadSafeBool m_Kill;
154 FThreadSafeBool m_Pause;
160 FCriticalSection FFTLock;
166 TObjectPtr<UFFTConfig> FFTConfig =
nullptr;
169 TFunction<void(
const TArray<float>&)> m_OnProcessedAudioReady;
173 kiss_fft_cpx* fftOutputBuffer =
nullptr;
176 kiss_fftr_cfg cfg = NULL;
180 TArray<float> RawMagnitudes;
183 TArray<float> RawMagnitudesHistory;
186 TArray<float> FrequencyBandsHistory;
189 TArray<float> FrequencyBands;
192 TArray<float> FrequencyBandEdges;
195 TArray<uint32> FrequencyBinsByBand;
198 TArray<float> AmplitudeHistory;
201 TArray<float> PitchHistory;
204 TArray<float> BeatHistory;
207 TArray<float> BeatRawMagnitudes;
210 TArray<FChannelBeatDetection> BeatDetectionForChannel;
213 TArray<bool> ProcessedChannel;
219 TArray<float*> PaddedFFTInputBuffer;
222 TArray<float> LastBufferChecksum;
225 uint32 ChannelMultiplier = 1;
228 TArray<FDetectionBeat> DetectedBeats;
231 int32 BeatSkipCount = 0;
234 std::atomic<bool> bFFTEventPending{
false };
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