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

◆ apply_taper()

MAYAFLUX_API 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 82 of file Taper.cpp.

83{
84 if (data.empty() || taper.empty())
85 return;
86 const size_t n = data.size();
87 const size_t tn = taper.size();
88 if (n == tn) {
89 for (size_t i = 0; i < n; ++i)
90 data[i] *= taper[i];
91 } else {
92 for (size_t i = 0; i < n; ++i)
93 data[i] *= taper[i % tn];
94 }
95}