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 <switchboard/export.h>
8#include <switchboard_core/SwitchboardObject.hpp>
9
10#include <map>
11#include <any>
12
13namespace switchboard {
14
15class SWITCHBOARDSDK_EXPORT Node : public SwitchboardObject {
16public:
17
24 static SBAnyMap getObjectTypeInfo() {
25 return SBAnyMap({
26 { OBJECT_TYPE_FIELD_PROPERTIES,
27 SBAnyMap({
28 { "numberOfInputs",
29 SBAnyMap({
30 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_INT },
31 { PROPERTY_FIELD_READ_ONLY, true },
32 { PROPERTY_FIELD_DESCRIPTION, "The number of inputs of the node." },
33 }) },
34 { "numberOfOutputs",
35 SBAnyMap({
36 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_INT },
37 { PROPERTY_FIELD_READ_ONLY, true },
38 { PROPERTY_FIELD_DESCRIPTION, "The number of outputs of the node." },
39 }) },
40 { "title",
41 SBAnyMap({
42 { PROPERTY_FIELD_TYPE, PROPERTY_TYPE_STRING },
43 { PROPERTY_FIELD_READ_ONLY, false },
44 { PROPERTY_FIELD_DESCRIPTION, "The title of the node." },
45 { PROPERTY_FIELD_DEFAULT_VALUE, std::string("") },
46 }) },
47 }) },
48 });
49 }
50
58
66 std::string getType() const;
67
73 unsigned int getNumberOfInputs() const;
74
80 unsigned int getNumberOfOutputs() const;
81
82 // MARK: Overridden methods
83
84 Result<SBAny> getValue(const std::string &key) override;
85 Result<SBAny> callAction(const std::string& actionName, const SBAnyMap& params) override;
86
87protected:
89 unsigned int numberOfInputs;
90
92 unsigned int numberOfOutputs;
93
95 std::string title;
96};
97
98}
unsigned int numberOfOutputs
The number of outputs (audio buses) for the node.
Definition Node.hpp:92
unsigned int numberOfInputs
The number of inputs (audio buses) for the node.
Definition Node.hpp:89
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:24
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:95
unsigned int getNumberOfOutputs() const
Gets the number of outputs for the node.
SwitchboardObject(const std::string &objectType)
SwitchboardObject constructor.