MayaFlux 0.2.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 501 of file Logic.cpp.

502{
503 update_context(value);
504 bool state_changed = (value != m_last_output);
505 auto& ctx = get_last_context();
506
507 for (const auto& cb : m_all_callbacks) {
508 bool should_call = false;
509
510 switch (cb.event_type) {
512 should_call = true;
513 break;
514
516 should_call = (bool)value;
517 break;
518
520 should_call = !value;
521 break;
522
524 should_call = state_changed;
525 break;
526
528 should_call = state_changed && (bool)value;
529 break;
530
532 should_call = state_changed && !value;
533 break;
534
536 should_call = cb.condition && cb.condition.value()(ctx);
537 break;
538 }
539
540 if (should_call) {
541 cb.callback(ctx);
542 }
543 }
544}
void update_context(double value) override
Updates the context with the latest sample value.
Definition Logic.cpp:478
NodeContext & get_last_context() override
Retrieves the last created context object.
Definition Logic.cpp:546
std::vector< LogicCallback > m_all_callbacks
Collection of all callback functions.
Definition Logic.hpp:617
double m_last_output
The most recent sample value generated by this oscillator.
Definition Node.hpp:374

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: