MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Constant.cpp
Go to the documentation of this file.
1#include "Constant.hpp"
2
3namespace MayaFlux::Nodes {
4
6 : m_value(value)
7{
9}
10
11//-----------------------------------------------------------------------------
12// Core processing
13//-----------------------------------------------------------------------------
14
15double Constant::process_sample(double /*input*/)
16{
18
21 }
22
23 return m_value;
24}
25
26std::vector<double> Constant::process_batch(unsigned int num_samples)
27{
28 std::vector<double> out(num_samples);
29 for (unsigned int i = 0; i < num_samples; ++i) {
30 out[i] = process_sample(0.0);
31 }
32 return out;
33}
34
35//-----------------------------------------------------------------------------
36// Parameter control
37//-----------------------------------------------------------------------------
38
44
45//-----------------------------------------------------------------------------
46// State snapshot
47//-----------------------------------------------------------------------------
48
54
61
62//-----------------------------------------------------------------------------
63// Context / callbacks
64//-----------------------------------------------------------------------------
65
70
75
83
84} // namespace MayaFlux::Nodes
std::vector< float > * out
glm::vec3 value
void restore_state() override
Restore value from last save_state() call.
Definition Constant.cpp:55
void update_context(double value) override
Update m_context with the latest value.
Definition Constant.cpp:66
void save_state() override
Snapshot the current value for later restoration.
Definition Constant.cpp:49
Constant(double value=0.0)
Construct with an initial constant value.
Definition Constant.cpp:5
NodeContext & get_last_context() override
Return the cached NodeContext from the last process_sample() call.
Definition Constant.cpp:71
std::vector< double > process_batch(unsigned int num_samples) override
Fill a buffer with the constant value.
Definition Constant.cpp:26
ConstantContext m_context
Definition Constant.hpp:135
void notify_tick(double value) override
Fire all registered on_tick() and on_tick_if() callbacks.
Definition Constant.cpp:76
double process_sample(double input=0.0) override
Return the constant value, ignoring input.
Definition Constant.cpp:15
void set_constant(double value)
Update the emitted value.
Definition Constant.cpp:39
void fire(NodeContext &ctx) const
Calls every entry whose condition, if any, holds.
Definition NodeUtils.cpp:68
double value
Current sample value.
Definition Node.hpp:63
Base context class for node callbacks.
Definition Node.hpp:53
HookList m_conditional_callbacks
Hooks fired on a tick only while their condition holds.
Definition Node.hpp:485
bool m_state_saved
tracks if the node's state has been saved by a snapshot operation
Definition Node.hpp:498
bool m_networked_node
Flag indicating if the node is part of a NodeNetwork This flag is used to disable event firing when t...
Definition Node.hpp:493
double m_last_output
The most recent sample value generated by this oscillator.
Definition Node.hpp:441
HookList m_callbacks
Hooks fired on every tick.
Definition Node.hpp:478
bool m_fire_events_during_snapshot
Internal flag controlling whether notify_tick fires during state snapshots Default: false (events don...
Definition Node.hpp:528
Contains the node-based computational processing system components.
Definition Chronie.hpp:14