MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
NodeSpec.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace MayaFlux::Nodes {
4
5inline constexpr uint32_t MAX_CHANNEL_COUNT = 32; ///< Hard limit imposed by uint32_t channel mask width
6
7/**
8 * @enum NodeChainSemantics
9 * @brief Defines how to handle existing nodes when creating a new chain
10 */
11enum NodeChainSemantics : uint8_t {
12 REPLACE_TARGET, ///< Unregister the target and register with the new chain node
13 PRESERVE_BOTH, ///< Preserve both nodes in the chain, add new chain node to root, i.e doubling the target signal
14 ONLY_CHAIN ///< Only keep the new chain node, unregistering the source and target
15};
16
17/**
18 * @enum NodeMixSemantics
19 * @brief Defines how to handle existing nodes when creating a new mix
20 */
21enum NodeBinaryOpSemantics : uint8_t {
22 REPLACE, ///< Unregister both nodes and register with the new binary op node
23 KEEP ///< Preserve both nodes in the binary op, add new binary op node to root, i.e doubling the signal
24};
25
26/**
27 * @brief Configuration settings for individual audio nodes
28 */
29struct NodeConfig {
30 size_t channel_cache_size { 256 }; ///< Number of cached channels for oprations
31 uint32_t max_channels { MAX_CHANNEL_COUNT }; ///< Cannot exceed MAX_CHANNEL_COUNT
32 size_t callback_cache_size { 64 };
34
37};
38
39/**
40 * @enum NodeState
41 * @brief Represents the processing state of a node in the audio graph
42 */
43enum NodeState : uint32_t {
44 INACTIVE = 0x00, ///< Engine is not processing this node
45 ACTIVE = 0x01, ///< Engine is processing this node
46 PENDING_REMOVAL = 0x02, ///< Node is marked for removal
47
48 MOCK_PROCESS = 0x04, ///< Node should be processed but output ignored
49 PROCESSED = 0x08, ///< Node has been processed this cycle
50
51 ENGINE_PROCESSED = ACTIVE | PROCESSED, ///< Engine has processed this node
52 EXTERMAL_PROCESSED = INACTIVE | PROCESSED, ///< External source has processed this node
53 ENGINE_MOCK_PROCESSED = ACTIVE | MOCK_PROCESS | PROCESSED, ///< Engine has mock processed this node
54};
55
56/**
57 * @struct RoutingState
58 * @brief Represents the state of routing transitions for a node
59 *
60 * This structure tracks the state of routing changes, including fade-in and fade-out phases,
61 * channel counts, and elapsed cycles. It's used to manage smooth transitions when routing
62 * changes occur, ensuring seamless audio output during dynamic reconfigurations of the processing graph.
63 */
65 double amount[32];
66 uint32_t cycles_elapsed {};
67 uint32_t from_channels {};
68 uint32_t to_channels {};
69 uint32_t fade_cycles {};
70
71 /**
72 * @enum Phase
73 * @brief Represents the current phase of a routing transition
74 *
75 * This enum defines the different phases of a routing transition, such as fade-out and fade-in.
76 * It allows the audio engine to manage the transition process effectively, ensuring that audio
77 * output remains seamless during dynamic changes in the processing graph.
78 */
79 enum Phase : uint8_t {
80 NONE = 0x00, ///< No routing transition is currently active
81 ACTIVE = 0x01, ///< Currently in the fade-out phase of a routing transition
82 COMPLETED = 0x02 ///< Routing transition has completed
83 } phase { Phase::NONE };
84};
85
86}
NodeState
Represents the processing state of a node in the audio graph.
Definition NodeSpec.hpp:43
@ PROCESSED
Node has been processed this cycle.
Definition NodeSpec.hpp:49
@ ACTIVE
Engine is processing this node.
Definition NodeSpec.hpp:45
@ EXTERMAL_PROCESSED
External source has processed this node.
Definition NodeSpec.hpp:52
@ INACTIVE
Engine is not processing this node.
Definition NodeSpec.hpp:44
@ ENGINE_MOCK_PROCESSED
Engine has mock processed this node.
Definition NodeSpec.hpp:53
@ MOCK_PROCESS
Node should be processed but output ignored.
Definition NodeSpec.hpp:48
@ PENDING_REMOVAL
Node is marked for removal.
Definition NodeSpec.hpp:46
@ ENGINE_PROCESSED
Engine has processed this node.
Definition NodeSpec.hpp:51
constexpr uint32_t MAX_CHANNEL_COUNT
Hard limit imposed by uint32_t channel mask width.
Definition NodeSpec.hpp:5
@ KEEP
Preserve both nodes in the binary op, add new binary op node to root, i.e doubling the signal.
Definition NodeSpec.hpp:23
@ REPLACE
Unregister both nodes and register with the new binary op node.
Definition NodeSpec.hpp:22
NodeChainSemantics
Defines how to handle existing nodes when creating a new chain.
Definition NodeSpec.hpp:11
@ PRESERVE_BOTH
Preserve both nodes in the chain, add new chain node to root, i.e doubling the target signal.
Definition NodeSpec.hpp:13
@ ONLY_CHAIN
Only keep the new chain node, unregistering the source and target.
Definition NodeSpec.hpp:14
@ REPLACE_TARGET
Unregister the target and register with the new chain node.
Definition NodeSpec.hpp:12
Contains the node-based computational processing system components.
Definition Chronie.hpp:11
uint32_t max_channels
Cannot exceed MAX_CHANNEL_COUNT.
Definition NodeSpec.hpp:31
size_t channel_cache_size
Number of cached channels for oprations.
Definition NodeSpec.hpp:30
NodeBinaryOpSemantics binary_op_semantics
Definition NodeSpec.hpp:36
NodeChainSemantics chain_semantics
Definition NodeSpec.hpp:35
Configuration settings for individual audio nodes.
Definition NodeSpec.hpp:29
enum MayaFlux::Nodes::RoutingState::Phase NONE
Phase
Represents the current phase of a routing transition.
Definition NodeSpec.hpp:79
@ COMPLETED
Routing transition has completed.
Definition NodeSpec.hpp:82
@ NONE
No routing transition is currently active.
Definition NodeSpec.hpp:80
@ ACTIVE
Currently in the fade-out phase of a routing transition.
Definition NodeSpec.hpp:81
Represents the state of routing transitions for a node.
Definition NodeSpec.hpp:64