MayaFlux 0.1.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 512 of file Logic.cpp.

513{
515 bool state_changed = (value != m_last_output);
516
517 for (const auto& cb : m_all_callbacks) {
518 bool should_call = false;
519
520 switch (cb.event_type) {
522 should_call = true;
523 break;
524
526 should_call = value;
527 break;
528
530 should_call = !value;
531 break;
532
534 should_call = state_changed;
535 break;
536
538 should_call = state_changed && value;
539 break;
540
542 should_call = state_changed && !value;
543 break;
544
546 should_call = cb.condition && cb.condition.value()(*m_last_context);
547 break;
548 }
549
550 if (should_call) {
551 cb.callback(*m_last_context);
552 }
553 }
554}
std::vector< LogicCallback > m_all_callbacks
Collection of all callback functions.
Definition Logic.hpp:601
std::unique_ptr< NodeContext > create_context(double value) override
Creates a context object for callbacks.
Definition Logic.cpp:486
double m_last_output
The most recent sample value generated by this oscillator.
Definition Node.hpp:378
std::unique_ptr< NodeContext > m_last_context
The last context object created for callbacks.
Definition Node.hpp:396

References MayaFlux::Nodes::Generator::CHANGE, MayaFlux::Nodes::Generator::CONDITIONAL, create_context(), MayaFlux::Nodes::Generator::FALSE, m_all_callbacks, MayaFlux::Nodes::Node::m_last_context, MayaFlux::Nodes::Node::m_last_output, MayaFlux::Nodes::Generator::TICK, MayaFlux::Nodes::Generator::TRUE, 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: