MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
NodeOperators.hpp
Go to the documentation of this file.
1#pragma once
2#include "NodeUtils.hpp"
3
4namespace MayaFlux::Nodes {
5
6/**
7 * @brief Connects two nodes in series (pipeline operator)
8 * @param lhs Source node
9 * @param rhs Target node
10 * @return The target node for further chaining
11 *
12 * Creates a connection where the output of the left-hand node
13 * becomes the input to the right-hand node. This allows for
14 * intuitive creation of processing chains:
15 *
16 * ```cpp
17 * auto chain = generator >> transformer >> output;
18 * ```
19 *
20 * The returned node is the right-hand node, allowing for
21 * further chaining of operations.
22 */
23std::shared_ptr<Node> operator>>(std::shared_ptr<Node> lhs, std::shared_ptr<Node> rhs);
24
25/**
26 * @brief Combines two nodes in parallel (addition operator)
27 * @param lhs First node
28 * @param rhs Second node
29 * @return A new node that outputs the sum of both nodes' outputs
30 *
31 * Creates a new node that processes both input nodes and sums their outputs.
32 * This allows for mixing multiple data sources or transformations:
33 *
34 * ```cpp
35 * auto combined = primary_source + secondary_source;
36 * ```
37 *
38 * The resulting node takes an input, passes it to both source nodes,
39 * and returns the sum of their outputs.
40 */
41std::shared_ptr<Node> operator+(std::shared_ptr<Node> lhs, std::shared_ptr<Node> rhs);
42
43/**
44 * @brief Multiplies the outputs of two nodes (multiplication operator)
45 * @param lhs First node
46 * @param rhs Second node
47 * @return A new node that outputs the product of both nodes' outputs
48 *
49 * Creates a new node that processes both input nodes and multiplies their outputs.
50 * This is useful for amplitude modulation, scaling operations, and other
51 * multiplicative transformations:
52 *
53 * ```cpp
54 * auto modulated = carrier * modulator;
55 * ```
56 *
57 * The resulting node takes an input, passes it to both source nodes,
58 * and returns the product of their outputs.
59 */
60std::shared_ptr<Node> operator*(std::shared_ptr<Node> lhs, std::shared_ptr<Node> rhs);
61
62/**
63 * @brief Sets the generator's amplitude
64 * @param node Generator node to modify
65 * @param value New amplitude value
66 *
67 * This operator allows setting the generator's amplitude using
68 * a more intuitive syntax, such as:
69 *
70 * ```cpp
71 * auto generator = std::make_shared<Sine>(440, 1, 0);
72 * generator * 0.5; // Halves the amplitude
73 * ```
74 */
75void operator*(std::shared_ptr<Node> node, double value);
76}
std::shared_ptr< Node > operator>>(std::shared_ptr< Node > lhs, std::shared_ptr< Node > rhs)
Connects two nodes in series (pipeline operator)
std::shared_ptr< Node > operator+(std::shared_ptr< Node > lhs, std::shared_ptr< Node > rhs)
Combines two nodes in parallel (addition operator)
std::shared_ptr< Node > operator*(std::shared_ptr< Node > lhs, std::shared_ptr< Node > rhs)
Multiplies the outputs of two nodes (multiplication operator)
Contains the node-based computational processing system components.
Definition Chronie.hpp:5