Skip to content

Node

class Node

Base class for Amplimix pipeline nodes.

This class presents the basic structure to create Amplimix pipeline nodes. Each Node of your pipelines must be derived from this class and implement the CreateInstance() and DestroyInstance() methods.

See
NodeInstance

Variables

Name Description
m_name The name of this node.

Functions

Name Description
Node Node constructor.
~Node Node destructor.
CreateInstance Creates a new instance of the node.
DestroyInstance Destroys the specified instance of the node.
GetName Returns the name of the node.
CanConsume Returns true if the node can consume audio data.
CanProduce Returns true if the node can produce audio data.
GetMaxInputCount Returns the maximum number of input connections the node can have.
GetMinInputCount Returns the minimum number of input connections the node can have.
Register Registers a new node.
Unregister Unregisters a node.
Construct Creates a new instance of the node with the given name * and returns its pointer. The returned pointer should be deleted using Node::Destruct().
Destruct Destroys the given node instance.
LockRegistry Locks the nodes' registry.
UnlockRegistry Unlocks the nodes' registry.
GetRegistry Gets the list of registered nodes.

Variable Details

m_name

AmString m_name

The name of this node.

Function Details

CanConsume

[[nodiscard]] virtual bool CanConsume() const = 0

Returns true if the node can consume audio data.

Return
true if the node can consume audio data, false otherwise.

CanProduce

[[nodiscard]] virtual bool CanProduce() const = 0

Returns true if the node can produce audio data.

Return
true if the node can produce audio data, false otherwise.

Construct

static NodeInstance* Construct(const AmString& name)

Creates a new instance of the node with the given name * and returns its pointer. The returned pointer should be deleted using Node::Destruct().

Parameter name
The name of the node.
Return
The node with the given name, or nullptr if none.

CreateInstance

* CreateInstance() const

Creates a new instance of the node.

Return
A new instance of the node.

DestroyInstance

virtual void DestroyInstance(NodeInstance* instance) const = 0

Destroys the specified instance of the node.

Parameter instance
Pointer to the instance to be destroyed.

Destruct

static void Destruct(const AmString& name, NodeInstance* instance)

Destroys the given node instance.

Parameter name
The name of the node.
Parameter instance
The node instance to destroy.

GetMaxInputCount

[[nodiscard]] virtual AmSize GetMaxInputCount() const = 0

Returns the maximum number of input connections the node can have.

Return
The maximum number of input connections the node can have.

GetMinInputCount

[[nodiscard]] virtual AmSize GetMinInputCount() const = 0

Returns the minimum number of input connections the node can have.

Return
The minimum number of input connections the node can have.

GetName

[[nodiscard]] const AmString& GetName() const

Returns the name of the node.

GetRegistry

static const std::map<AmString, Node*>& GetRegistry()

Gets the list of registered nodes.

Return
The registry of nodes.

LockRegistry

static void LockRegistry()

Locks the nodes' registry.

Warning

This function is mainly used for internal purposes. It's called before the Engine initialization, to discard the registration of new nodes after the engine is fully loaded.

Node

explicit Node(AmString name)

Node constructor.

Parameter name
Name of the node. Should be unique within the pipeline.

Register

static void Register(Node* node)

Registers a new node.

Parameter node
The node to add in the registry.

UnlockRegistry

static void UnlockRegistry()

Unlocks the nodes' registry.

Warning

This function is mainly used for internal purposes. It's called after the Engine deinitialization, to allow the registration of new nodes after the engine is fully unloaded.

Unregister

static void Unregister(const Node* node)

Unregisters a node.

Parameter node
The node to remove from the registry.

~Node

virtual ~Node()

Node destructor.