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

◆ notify_tick()

void MayaFlux::Nodes::Input::InputNode::notify_tick ( double  value)
overrideprotectedvirtual

Fires the hooks for one delivered input.

Called only from process_input(), so every hook runs on the thread that delivers input and never on the graph thread. process_sample() only advances smoothing and does not notify. The context, previous-value and range state are therefore owned by the input thread, and Node::m_last_output by the graph thread.

Implements MayaFlux::Nodes::Node.

Reimplemented in MayaFlux::Nodes::Input::MIDINode, MayaFlux::Nodes::Input::OSCNode, and MayaFlux::Nodes::Input::TabletNode.

Definition at line 211 of file InputNode.cpp.

212{
214 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
215 auto& ctx = static_cast<InputContext&>(get_last_context());
216
217 m_callbacks.fire(ctx);
219
220 for (const auto& entry : m_input_callbacks.snapshot()) {
221 bool should_fire = false;
222
223 switch (static_cast<InputEventType>(entry.tag)) {
225 should_fire = true;
226 break;
227
229 const double epsilon = entry.params[0];
230 should_fire = std::abs(value - m_previous_value) > epsilon;
231 break;
232 }
233
235 should_fire = (m_previous_value < entry.params[0] && value >= entry.params[0]);
236 break;
237
239 should_fire = (m_previous_value >= entry.params[0] && value < entry.params[0]);
240 break;
241
243 const double min = entry.params[0];
244 const double max = entry.params[1];
245 bool in_range_now = (value >= min && value <= max);
246 should_fire = (!m_was_in_range && in_range_now);
247 m_was_in_range = in_range_now;
248 break;
249 }
250
252 const double min = entry.params[0];
253 const double max = entry.params[1];
254 bool in_range_now = (value >= min && value <= max);
255 should_fire = (m_was_in_range && !in_range_now);
256 m_was_in_range = in_range_now;
257 break;
258 }
259
261 should_fire = (m_previous_value < 0.5 && value >= 0.5);
262 break;
263
265 should_fire = (m_previous_value >= 0.5 && value < 0.5);
266 break;
267
269 should_fire = entry.condition && entry.condition.value()(ctx);
270 break;
271 }
272
273 if (should_fire) {
274 entry.hook(ctx);
275 }
276 }
277
279}
glm::ivec3 min
glm::ivec3 max
glm::vec3 value
void fire(NodeContext &ctx) const
Calls every entry whose condition, if any, holds.
Definition NodeUtils.cpp:68
void update_context(double value) override
Update context after processing.
Definition InputNode.cpp:98
NodeContext & get_last_context() override
Retrieves the last created context object.
HookList m_conditional_callbacks
Hooks fired on a tick only while their condition holds.
Definition Node.hpp:485
HookList m_callbacks
Hooks fired on every tick.
Definition Node.hpp:478
InputEventType
Types of input events that can trigger callbacks.
Definition InputNode.hpp:14
@ BUTTON_PRESS
Button went from 0.0 to 1.0.
@ THRESHOLD_FALLING
Value crossed threshold downward.
@ VALUE_CHANGE
Value changed from previous.
@ THRESHOLD_RISING
Value crossed threshold upward.
@ CONDITIONAL
User-provided condition.
@ RANGE_ENTER
Value entered specified range.
@ RANGE_EXIT
Value exited specified range.
@ BUTTON_RELEASE
Button went from 1.0 to 0.0.

References MayaFlux::Nodes::Input::BUTTON_PRESS, MayaFlux::Nodes::Input::BUTTON_RELEASE, MayaFlux::Nodes::Input::CONDITIONAL, MayaFlux::Nodes::HookList::fire(), get_last_context(), MayaFlux::Nodes::Node::m_callbacks, MayaFlux::Nodes::Node::m_conditional_callbacks, m_input_callbacks, m_previous_value, m_was_in_range, max, min, MayaFlux::Nodes::Input::RANGE_ENTER, MayaFlux::Nodes::Input::RANGE_EXIT, MayaFlux::Nodes::HookList::snapshot(), MayaFlux::Nodes::Input::THRESHOLD_FALLING, MayaFlux::Nodes::Input::THRESHOLD_RISING, MayaFlux::Nodes::Input::TICK, update_context(), value, and MayaFlux::Nodes::Input::VALUE_CHANGE.

Referenced by MayaFlux::Nodes::Input::MIDINode::notify_tick(), MayaFlux::Nodes::Input::OSCNode::notify_tick(), MayaFlux::Nodes::Input::TabletNode::notify_tick(), and process_input().

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