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

◆ step_sequence()

MAYAFLUX_API double MayaFlux::Kinesis::Discrete::step_sequence ( std::span< const double >  window,
std::span< double >  coefs 
)
noexcept

Table of values advanced by a trigger.

Returns values[cursor], starting at the first value. Each time window[0] rises through the threshold the cursor advances by one and wraps. A held high input advances once.

Definition at line 629 of file Kernels.cpp.

630{
631 if (coefs.size() < 5)
632 return 0.0;
633
634 const auto n = static_cast<size_t>(std::max(coefs[3], 0.0));
635 if (n == 0 || coefs.size() < 4 + n)
636 return 0.0;
637
638 const bool high = !window.empty() && window.front() > coefs[0];
639 const bool latched = coefs[2] > 0.5;
640 auto cursor = static_cast<size_t>(std::max(coefs[1], 0.0)) % n;
641
642 if (high && !latched)
643 cursor = (cursor + 1) % n;
644
645 coefs[1] = static_cast<double>(cursor);
646 coefs[2] = high ? 1.0 : 0.0;
647 return coefs[4 + cursor];
648}
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23

References window.

Referenced by step_pattern().

+ Here is the caller graph for this function: