Skip to content

Add Outputs to Node

Output Requirements

Properties within your nodes, which you would like to define as outputs, must have a public getter. They can have a public or non-public setter as well.

Value Output

Let's say, we would like to create a node, which doubles the value it receives via its input port and pushes it to its output port. We can achieve that by defining an output node property with the NodeOutputAttribute and propagate any changes to it via the OnPropertyChanged() method.

[Node(Name = "Double")]
public class DoubleNode : NodeBase
{
    private float _in;

    [NodeInput]
    public float In
    {
        get => _in;
        set
        {
            _in = value;
            OnPropertyChanged(nameof(Out));
        }
    }

    [NodeOutput]
    public float Out => 2 * In;

    public DoubleNode(IExtensionApi api)
        : base(api)
    {
    }
}

Info

Any changes to node output properties have to be propagated via the OnPropertyChanged() method. Otherwise, Audectra won't know when there is a value change that needs to be propagated across the node network.