492 {
493 using FP = fl::fixed_point<16, 16>;
495
496
498 for (int n = 0; n < N; ++n) {
499 win[n] = alpha16(65535);
500 }
501 return;
502 }
503
504 const FP two_pi(6.2831853f);
505 const FP invNm1 =
FP(1) /
FP(N - 1);
506 const FP phase_step = two_pi * invNm1;
507
508
509 constexpr FP bh_a0(0.35875f);
510 constexpr FP bh_a1(0.48829f);
511 constexpr FP bh_a2(0.14128f);
512 constexpr FP bh_a3(0.01168f);
513
514 constexpr FP half(0.5f);
515 constexpr FP one(1.0f);
516
518 for (int n = 0; n < N; ++n) {
520 switch (type) {
522
523 FP phase2 = phase + phase;
524 FP phase3 = phase2 + phase;
525 w = bh_a0 - bh_a1 * FP::cos(phase)
526 + bh_a2 * FP::cos(phase2)
527 - bh_a3 * FP::cos(phase3);
528 break;
529 }
531 default:
532 w = half * (one - FP::cos(phase));
533 break;
534 }
536 if (raw < 0) raw = 0;
537 if (raw > 65535) raw = 65535;
538 win[n] = alpha16(static_cast<unsigned short>(raw));
539 phase = phase + phase_step;
540 }
541 }
constexpr i32 raw() const FL_NOEXCEPT
void resize(fl::size n) FL_NOEXCEPT