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

◆ edge_divider()

MAYAFLUX_API bool MayaFlux::Kinesis::Discrete::edge_divider ( double  input,
std::span< double >  coefs 
)
noexcept

Gate divider: the input passes only during every n-th pulse.

coefs: [threshold, latched, edges, n, offset, pass]. The pulse keeps its own length; the pulses in between are dropped.

Definition at line 109 of file Boolean.cpp.

110{
111 if (coefs.size() < 6)
112 return false;
113
114 const bool high = input > coefs[0];
115 if (rises(high, coefs[1])) {
116 const size_t n = std::max<size_t>(index_of(coefs[3]), 1);
117 const size_t edge = index_of(coefs[2]);
118 coefs[5] = (edge % n) == (index_of(coefs[4]) % n) ? 1.0 : 0.0;
119 coefs[2] = static_cast<double>(edge + 1);
120 }
121 return high && coefs[5] > 0.5;
122}
Core::GlobalInputConfig input
Definition Config.cpp:42

References input.