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

◆ on_tick()

HookId MayaFlux::Nodes::Node::on_tick ( const NodeHook &  callback)
virtual

Registers a callback to be called on each tick.

Parameters
callbackFunction to call with the current node context

Registers a callback function that will be called each time the node produces a new output value. The callback receives a NodeContext object containing information about the node's current state.

This mechanism enables external components to monitor and react to the node's activity without interrupting the processing flow.

Example:

node->on_tick([](NodeContext& ctx) {
std::cout << "Node produced value: " << ctx.value << std::endl;
});
double value
Current sample value.
Definition Node.hpp:63
Base context class for node callbacks.
Definition Node.hpp:53
Returns
Id of the registration, usable with unhook(). A callback equivalent to one already registered is not added again and the existing id is returned.

Reimplemented in MayaFlux::Nodes::ChainNode.

Definition at line 19 of file Node.cpp.

20{
21 return m_callbacks.add_unique(callback, callback.target_type());
22}
PickCallback callback
Definition Picker.cpp:22
HookId add_unique(NodeHook hook, const std::type_info &key, uint8_t tag=0, std::array< double, 2 > params={})
Appends unless an entry with the same key and params exists, in which case that entry's id is returne...
HookList m_callbacks
Hooks fired on every tick.
Definition Node.hpp:478

References MayaFlux::Nodes::HookList::add_unique(), callback, and m_callbacks.

+ Here is the call graph for this function: