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