feat(dsp): SpectralProcessor sample_rate param
This commit is contained in:
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#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),
|
: nfft_(nfft), hop_(hop), frame_count_(0), output_pos_(0),
|
||||||
detector_(nfft, 44100.0f) {
|
detector_(nfft, sample_rate) {
|
||||||
window_ = new double[nfft_];
|
window_ = new double[nfft_];
|
||||||
computeWindow();
|
computeWindow();
|
||||||
fft::init_plan(&plan_, static_cast<uint32_t>(std::log2(nfft_)));
|
fft::init_plan(&plan_, static_cast<uint32_t>(std::log2(nfft_)));
|
||||||
|
|||||||
+2
-1
@@ -11,7 +11,8 @@ constexpr size_t DEFAULT_HOP = 512;
|
|||||||
|
|
||||||
class SpectralProcessor {
|
class SpectralProcessor {
|
||||||
public:
|
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();
|
~SpectralProcessor();
|
||||||
|
|
||||||
void setDetectorParams(const std::vector<DetectorBand>& bands);
|
void setDetectorParams(const std::vector<DetectorBand>& bands);
|
||||||
|
|||||||
Reference in New Issue
Block a user