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

◆ phasor_bank_state()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::phasor_bank_state ( std::span< const double >  increments,
std::span< const double >  scales = {},
std::span< const double >  am_increments = {},
std::span< const double >  phases = {},
std::span< const double >  am_phases = {} 
)

Builds the array phasor_bank reads and writes.

Parameters
incrementsRadians per sample of each partial; sets the count
scalesAmplitude of each partial; missing entries are 1
am_incrementsRadians per sample of each partial's slow amplitude swell; missing entries are 0, which holds the swell at one half
phasesStarting phase of each partial; missing entries are 0
am_phasesStarting phase of each swell; missing entries are 0

Layout: [N, increments, scales, am_increments, phases, am_phases], each column N long. Whether partials start together or apart is only what the phase columns hold.

Definition at line 178 of file Kernels.cpp.

184{
185 const size_t n = increments.size();
186 std::vector<double> state(1 + 5 * n, 0.0);
187 state.front() = static_cast<double>(n);
188
189 for (size_t i = 0; i < n; ++i) {
190 state.at(1 + i) = increments[i];
191 state.at(1 + n + i) = i < scales.size() ? scales[i] : 1.0;
192 state.at(1 + 2 * n + i) = i < am_increments.size() ? am_increments[i] : 0.0;
193 state.at(1 + 3 * n + i) = i < phases.size() ? phases[i] : 0.0;
194 state.at(1 + 4 * n + i) = i < am_phases.size() ? am_phases[i] : 0.0;
195 }
196 return state;
197}