502 {
503 using FP = fl::fixed_point<16, 16>;
505
506
508 for (int n = 0; n < N; ++n) {
509 win[n] = alpha16(65535);
510 }
511 return;
512 }
513
514 const FP two_pi(6.2831853f);
515 const FP invNm1 =
FP(1) /
FP(N - 1);
516 const FP phase_step = two_pi * invNm1;
517
518
519 constexpr FP bh_a0(0.35875f);
520 constexpr FP bh_a1(0.48829f);
521 constexpr FP bh_a2(0.14128f);
522 constexpr FP bh_a3(0.01168f);
523
524 constexpr FP half(0.5f);
525 constexpr FP one(1.0f);
526
528 for (int n = 0; n < N; ++n) {
530 switch (type) {
532
533 FP phase2 = phase + phase;
534 FP phase3 = phase2 + phase;
535 w = bh_a0 - bh_a1 * FP::cos(phase)
536 + bh_a2 * FP::cos(phase2)
537 - bh_a3 * FP::cos(phase3);
538 break;
539 }
541 default:
542 w = half * (one - FP::cos(phase));
543 break;
544 }
546 if (raw < 0) raw = 0;
547 if (raw > 65535) raw = 65535;
548 win[n] = alpha16(static_cast<unsigned short>(raw));
549 phase = phase + phase_step;
550 }
551 }
constexpr i32 raw() const FL_NO_EXCEPT
void resize(fl::size n) FL_NO_EXCEPT