MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ apply_taper()

void MayaFlux::Kinesis::Discrete::apply_taper ( std::span< double >  data,
std::span< const double >  taper 
)
noexcept

Multiply data element-wise by a precomputed taper.

Applied cyclically if taper is shorter than data; truncated if longer. The common case (equal sizes) is a straight element-wise multiply.

Parameters
dataTarget span (modified in place)
taperCoefficient span

Definition at line 75 of file Taper.cpp.

76{
77 if (data.empty() || taper.empty())
78 return;
79 const size_t n = data.size();
80 const size_t tn = taper.size();
81 if (n == tn) {
82 for (size_t i = 0; i < n; ++i)
83 data[i] *= taper[i];
84 } else {
85 for (size_t i = 0; i < n; ++i)
86 data[i] *= taper[i % tn];
87 }
88}