Switchboard Extension SDK
Loading...
Searching...
No Matches
Node.hpp
1//
2// Created by Balazs Kiss on 2025. 02. 23..
3//
4
5#pragma once
6
7#include <any>
8#include <map>
9#include <switchboard/export.h>
10#include <switchboard_core/SwitchboardObject.hpp>
11
12namespace switchboard {
13
14class SWITCHBOARDSDK_EXPORT Node : public SwitchboardObject {
15public:
22 static SBAnyMap getObjectTypeInfo() {
23 return SBAnyMap(
24 {
25 { OBJECT_TYPE_FIELD_PROPERTIES,
26 SBAnyMap(
27 {
28 { "numberOfInputs",
29 SBAnyMap(
30 {
31 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_INT },
32 { PROPERTY_FIELD_READ_ONLY, true },
33 { PROPERTY_FIELD_DESCRIPTION,
34 "Number of audio input buses. Fixed when the node is created; 0 for source nodes and for nodes that do not process audio." },
35 }
36 ) },
37 { "numberOfOutputs",
38 SBAnyMap(
39 {
40 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_INT },
41 { PROPERTY_FIELD_READ_ONLY, true },
42 { PROPERTY_FIELD_DESCRIPTION,
43 "Number of audio output buses. Fixed when the node is created; 0 for sink nodes and for nodes that do not process audio." },
44 }
45 ) },
46 { "title",
47 SBAnyMap(
48 {
49 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_STRING },
50 { PROPERTY_FIELD_READ_ONLY, false },
51 { PROPERTY_FIELD_DESCRIPTION,
52 "Free-form display name that a user interface can show for the node. Does not affect processing." },
53 { PROPERTY_FIELD_DEFAULT_VALUE, std::string("") },
54 }
55 ) },
56 { "type",
57 SBAnyMap(
58 {
59 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_STRING },
60 { PROPERTY_FIELD_READ_ONLY, true },
61 { PROPERTY_FIELD_DESCRIPTION,
62 "The node type the node was created with, for example `Switchboard.Gain`." },
63 }
64 ) },
65 }
66 ) },
67 }
68 );
69 }
70
78
86 std::string getType() const;
87
93 unsigned int getNumberOfInputs() const;
94
100 unsigned int getNumberOfOutputs() const;
101
102 // MARK: Overridden methods
103
104 Result<SBAny> getValue(const std::string& key) override;
105 Result<SBAny> callAction(const std::string& actionName, const SBAnyMap& params) override;
106
107protected:
109 unsigned int numberOfInputs;
110
112 unsigned int numberOfOutputs;
113
115 std::string title;
116};
117
118}
unsigned int numberOfOutputs
The number of outputs (audio buses) for the node.
Definition Node.hpp:112
unsigned int numberOfInputs
The number of inputs (audio buses) for the node.
Definition Node.hpp:109
std::string getType() const
Gets the type of the node.
Result< SBAny > callAction(const std::string &actionName, const SBAnyMap &params) override
Calls an action on the object.
Node(uint numberOfInputs, uint numberOfOutputs)
Node constructor.
static SBAnyMap getObjectTypeInfo()
Static type-info fragment for the abstract Node base. Concrete node subtypes should merge this with t...
Definition Node.hpp:22
Result< SBAny > getValue(const std::string &key) override
Gets a value from the object.
unsigned int getNumberOfInputs() const
Gets the number of inputs for the node.
std::string title
The title of the node that can be displayed in the UI.
Definition Node.hpp:115
unsigned int getNumberOfOutputs() const
Gets the number of outputs for the node.
SwitchboardObject(const std::string &objectType)
SwitchboardObject constructor.