29 this->samples_minus_1 = -1.0f +
samples;
31 this->i_half_samples =
samples / 2 - 1;
36 float result = idx < i_half_samples ? factor_internal(idx) : factor_internal(i_samples-idx-1);
37 return result>1.0f ? 1.0f : result;
41 inline int samples() {
return i_samples; }
44 float samples_minus_1 = 0.0f;
46 int i_half_samples = 0;
47 const float twoPi = 6.28318531f;
48 const float fourPi = 12.56637061f;
49 const float sixPi = 18.84955593f;
52 virtual float factor_internal(
int idx) = 0;
55 inline float ratio(
int idx) {
56 return (
static_cast<float>(idx)) / samples_minus_1;
80 for (
int j = 0; j < len; j++) {
81 buffer[j] = p_wf->
factor(j);
91 float factor_internal(
int idx)
override {
92 return idx < len ? buffer[idx] : buffer[i_samples - idx];
104 float factor_internal(
int idx) {
return 1.0f; }
115 float factor_internal(
int idx) {
116 return 0.54f - (0.46f * cos(twoPi * ratio(idx)));
128 float factor_internal(
int idx) {
129 return 0.54f * (1.0f - cos(twoPi * ratio(idx)));
141 float factor_internal(
int idx) {
142 return 1.0f - ((2.0f * fabs((idx - 1) -
143 (
static_cast<float>(i_samples - 1) / 2.0f))) /
157 float factor_internal(
int idx)
override {
158 float r = ratio(idx);
159 return 0.355768f - (0.487396f * (cos(twoPi * r))) +
160 (0.144232f * (cos(fourPi * r))) - (0.012604f * (cos(sixPi * r)));
173 float factor_internal(
int idx)
override {
174 float r = ratio(idx);
175 return 0.42323f - (0.49755f * (cos(twoPi * r))) +
176 (0.07922f * (cos(fourPi * r)));
188 float factor_internal(
int idx)
override{
189 float r = ratio(idx);
190 return 0.3635819f - (0.4891775f * (cos(twoPi * r))) +
191 (0.1365995f * (cos(fourPi * r))) - (0.0106411f * (cos(sixPi * r)));
203 float factor_internal(
int idx)
override{
204 float r = ratio(idx);
205 return 0.35875f - (0.48829f * (cos(twoPi * r))) +
206 (0.14128f * (cos(fourPi * r))) - (0.01168f * (cos(sixPi * r)));
218 float factor_internal(
int idx)
override{
219 float r = ratio(idx);
220 return 0.2810639f - (0.5208972f * cos(twoPi * r)) +
221 (0.1980399f * cos(fourPi * r));
233 float factor_internal(
int idx)
override{
234 float tmp = (((idx - 1) - samples_minus_1 / 2.0f) / (samples_minus_1 / 2.0f));
235 return 1.0f - (tmp*tmp);