27template <
typename ContextT = NodeContext>
62template <
typename ContextT>
66 return std::ranges::any_of(callbacks,
68 return hook.target_type() == callback.target_type();
76template <
typename ContextT>
81 callbacks.push_back(callback);
91template <
typename ContextT>
96 auto it = callbacks.begin();
97 while (it != callbacks.end()) {
98 if (it->target_type() == callback.target_type()) {
99 it = callbacks.erase(it);
112 const std::vector<std::pair<NodeHook, NodeCondition>>& callbacks,
119 const std::vector<std::pair<NodeHook, NodeCondition>>& callbacks,
128 std::vector<std::pair<NodeHook, NodeCondition>>& callbacks,
137 std::vector<std::pair<NodeHook, NodeCondition>>& callbacks,
243std::vector<uint32_t>
get_active_channels(
const std::shared_ptr<Nodes::Node>& node, uint32_t fallback_channel = 0);
251std::vector<uint32_t>
get_active_channels(uint32_t channel_mask, uint32_t fallback_channel = 0);
Base context class for node callbacks.
TypedHook<> NodeHook
Alias for TypedHook<NodeContext>.
NodeState
Represents the processing state of a node in the audio graph.
bool callback_pair_exists(const std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeHook &callback, const NodeCondition &condition)
Returns true if the exact callback+condition pair is already present.
void atomic_add_flag(std::atomic< NodeState > &state, NodeState flag)
Atomically adds a flag to a node state.
bool safe_remove_conditional_callback(std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeCondition &callback)
Removes all conditional callbacks whose condition target_type() matches.
bool callback_exists(const std::vector< TypedHook< ContextT > > &callbacks, const TypedHook< ContextT > &callback)
Returns true if an equivalent callback is already present in the collection.
std::vector< uint32_t > get_active_channels(const std::shared_ptr< Nodes::Node > &node, uint32_t fallback_channel)
Extracts active channel list from a node's channel mask.
void atomic_set_strong(std::atomic< NodeState > &flag, NodeState &expected, const NodeState &desired)
Atomically sets a node state flag with strong memory ordering.
bool conditional_callback_exists(const std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeCondition &callback)
Returns true if a condition function is already present in a conditional callback collection.
void try_reset_processed_state(std::shared_ptr< Node > node)
Attempts to reset the processed state of a node.
void atomic_inc_modulator_count(std::atomic< uint32_t > &count, int amount)
Atomically increments the modulator count by a specified amount.
std::function< void(ContextT &)> TypedHook
Callback function type for node processing events, parameterised on context type.
void atomic_remove_flag(std::atomic< NodeState > &state, NodeState flag)
Atomically removes a flag from a node state.
void atomic_set_flag_strong(std::atomic< NodeState > &flag, const NodeState &desired)
Atomically sets a node state flag to a specific value.
bool safe_remove_callback(std::vector< TypedHook< ContextT > > &callbacks, const TypedHook< ContextT > &callback)
Removes all callbacks whose target_type() matches that of the supplied callback.
std::function< bool(NodeContext &)> NodeCondition
Predicate function type for conditional callbacks.
void atomic_dec_modulator_count(std::atomic< uint32_t > &count, int amount)
Atomically decrements the modulator count by a specified amount.
bool safe_add_conditional_callback(std::vector< std::pair< NodeHook, NodeCondition > > &callbacks, const NodeHook &callback, const NodeCondition &condition)
Adds a conditional callback if the exact pair is not already present.
void atomic_set_flag_weak(std::atomic< NodeState > &flag, NodeState &expected, const NodeState &desired)
Atomically sets a node state flag with weak memory ordering.
void update_routing_state(RoutingState &state)
Updates the routing state for a node based on its current channel usage.
bool safe_add_callback(std::vector< TypedHook< ContextT > > &callbacks, const TypedHook< ContextT > &callback)
Adds a callback to the collection if an equivalent one is not already present.
Contains the node-based computational processing system components.