29template <
typename NumericType>
32 jassert (theSampleRate > 0.0);
33 jassert (frequency >= 0.0 && frequency <= theSampleRate * 0.5);
35 constexpr Complex<double> j (0, 1);
36 auto order = getFilterOrder();
38 Complex<double> numerator = 0.0, factor = 1.0;
41 const auto* coefs = coefficients.begin();
43 for (
size_t n = 0; n <= order; ++n)
45 numerator +=
static_cast<double> (coefs[n]) * factor;
49 return std::abs (numerator);
53template <
typename NumericType>
55 size_t numSamples,
double theSampleRate)
const noexcept
57 jassert (theSampleRate > 0.0);
59 constexpr Complex<double> j (0, 1);
60 const auto* coefs = coefficients.begin();
61 auto order = getFilterOrder();
63 for (
size_t i = 0; i < numSamples; ++i)
65 jassert (frequencies[i] >= 0.0 && frequencies[i] <= theSampleRate * 0.5);
67 Complex<double> numerator = 0.0;
68 Complex<double> factor = 1.0;
71 for (
size_t n = 0; n <= order; ++n)
73 numerator +=
static_cast<double> (coefs[n]) * factor;
77 magnitudes[i] = std::abs (numerator);
82template <
typename NumericType>
85 jassert (theSampleRate > 0.0);
86 jassert (frequency >= 0.0 && frequency <= theSampleRate * 0.5);
88 constexpr Complex<double> j (0, 1);
90 Complex<double> numerator = 0.0;
91 Complex<double> factor = 1.0;
94 const auto* coefs = coefficients.begin();
95 auto order = getFilterOrder();
97 for (
size_t n = 0; n <= order; ++n)
99 numerator +=
static_cast<double> (coefs[n]) * factor;
103 return std::arg (numerator);
107template <
typename NumericType>
109 size_t numSamples,
double theSampleRate)
const noexcept
111 jassert (theSampleRate > 0.0);
113 constexpr Complex<double> j (0, 1);
114 const auto* coefs = coefficients.begin();
115 auto order = getFilterOrder();
117 for (
size_t i = 0; i < numSamples; ++i)
119 jassert (frequencies[i] >= 0.0 && frequencies[i] <= theSampleRate * 0.5);
121 Complex<double> numerator = 0.0, factor = 1.0;
124 for (
size_t n = 0; n <= order; ++n)
126 numerator +=
static_cast<double> (coefs[n]) * factor;
130 phases[i] = std::arg (numerator);
135template <
typename NumericType>
138 auto magnitude =
static_cast<NumericType
> (0);
140 auto* coefs = coefficients.getRawDataPointer();
141 auto n =
static_cast<size_t> (coefficients.size());
143 for (
size_t i = 0; i < n; ++i)
149 auto magnitudeInv = 1 / (4 * std::sqrt (magnitude));
151 FloatVectorOperations::multiply (coefs, magnitudeInv,
static_cast<int> (n));
static constexpr FloatType twoPi