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

◆ notify_tick()

void MayaFlux::Nodes::Generator::Logic::notify_tick ( double  value)
overrideprotectedvirtual

Notifies all registered callbacks about a new sample.

Parameters
valueThe newly generated sample

This method is called internally whenever a new sample is generated, creating the appropriate context and invoking all registered callbacks that should receive notification about this sample.

Implements MayaFlux::Nodes::Node.

Definition at line 503 of file Logic.cpp.

504{
505 update_context(value);
506 bool state_changed = (value != m_last_output);
507 auto& ctx = get_last_context();
508
509 for (const auto& cb : m_all_callbacks) {
510 bool should_call = false;
511
512 switch (cb.event_type) {
514 should_call = true;
515 break;
516
518 should_call = (bool)value;
519 break;
520
522 should_call = !value;
523 break;
524
526 should_call = state_changed;
527 break;
528
530 should_call = state_changed && (bool)value;
531 break;
532
534 should_call = state_changed && !value;
535 break;
536
538 should_call = cb.condition && cb.condition.value()(ctx);
539 break;
540 }
541
542 if (should_call) {
543 cb.callback(ctx);
544 }
545 }
546}
void update_context(double value) override
Updates the context with the latest sample value.
Definition Logic.cpp:474
NodeContext & get_last_context() override
Retrieves the last created context object.
Definition Logic.cpp:548
std::vector< LogicCallback > m_all_callbacks
Collection of all callback functions.
Definition Logic.hpp:631
double m_last_output
The most recent sample value generated by this oscillator.
Definition Node.hpp:377

References MayaFlux::Nodes::Generator::CHANGE, MayaFlux::Nodes::Generator::CONDITIONAL, MayaFlux::Nodes::Generator::FALSE, get_last_context(), m_all_callbacks, MayaFlux::Nodes::Node::m_last_output, MayaFlux::Nodes::Generator::TICK, MayaFlux::Nodes::Generator::TRUE, update_context(), MayaFlux::Nodes::Generator::WHILE_FALSE, and MayaFlux::Nodes::Generator::WHILE_TRUE.

Referenced by process_multi_input(), and process_sample().

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