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

◆ dispatch_audio_sinks()

void MayaFlux::Nexus::dispatch_audio_sinks ( std::vector< AudioSink > &  sinks,
const InfluenceContext ctx 
)

For each sink that has a producer fn, call it and push the result.

Sinks without a fn are untouched.

Parameters
sinksSink vector owned by the calling Emitter or Agent.
ctxCurrent InfluenceContext passed to each fn.

Definition at line 71 of file Sinks.cpp.

72{
73 for (auto& s : sinks) {
74 if (!s.fn) {
75 continue;
76 }
77 auto variant = s.fn(ctx);
78
79 if (auto* vec = std::get_if<std::vector<double>>(&variant)) {
80 s.writer->set_data(std::span<const double>(*vec));
81 } else {
82 Kakshya::EigenAccess acc(variant);
83 const Eigen::VectorXd v = acc.to_vector();
84 std::vector<double> samples(static_cast<size_t>(v.size()));
85 Eigen::Map<Eigen::VectorXd>(samples.data(), v.size()) = v;
86 s.writer->set_data(std::span<const double>(samples));
87 }
88 }
89}

References MayaFlux::Kakshya::EigenAccess::to_vector().

Referenced by MayaFlux::Nexus::Emitter::invoke(), and MayaFlux::Nexus::Agent::invoke_influence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: