16 explicit Tuner(
int sample_rate, real_t freq)
19 DSPLIB_ASSERT(std::abs(_freq) <= (_fs / 2),
"tuner freq must be in range (-fs/2 : fs/2)");
23 const int n = x.size();
25 for (
int i = 0; i < n; i++) {
26 const real_t phase = 2 * pi * _freq * _phase / _fs;
27 const cmplx_t w = {std::cos(phase), std::sin(phase)};
30 _phase = (_phase < _fs) ? _phase : 0;
35 [[nodiscard]] real_t freq()
const noexcept {
39 [[nodiscard]]
int sample_rate()
const noexcept {
44 return this->process(x);