feat(dsp): SpectralProcessor sample_rate param

This commit is contained in:
2026-08-21 01:32:50 +03:00
parent 7bf5a4a80c
commit 7659eb0362
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
#include <cstring>
#include <vector>
SpectralProcessor::SpectralProcessor(size_t nfft, size_t hop)
SpectralProcessor::SpectralProcessor(size_t nfft, size_t hop, float sample_rate)
: nfft_(nfft), hop_(hop), frame_count_(0), output_pos_(0),
detector_(nfft, 44100.0f) {
detector_(nfft, sample_rate) {
window_ = new double[nfft_];
computeWindow();
fft::init_plan(&plan_, static_cast<uint32_t>(std::log2(nfft_)));
+2 -1
View File
@@ -11,7 +11,8 @@ constexpr size_t DEFAULT_HOP = 512;
class SpectralProcessor {
public:
SpectralProcessor(size_t nfft = DEFAULT_NFFT, size_t hop = DEFAULT_HOP);
SpectralProcessor(size_t nfft = DEFAULT_NFFT, size_t hop = DEFAULT_HOP,
float sample_rate = 44100.0f);
~SpectralProcessor();
void setDetectorParams(const std::vector<DetectorBand>& bands);