Switchboard Extension SDK
Loading...
Searching...
No Matches
AudioNode.hpp
1//
2// AudioNode.hpp
3// SwitchboardSDK
4//
5// Created by Balázs Kiss on 2022. 03. 03..
6// Copyright © 2022. Synervoz Inc. All rights reserved.
7//
8
9#pragma once
10
11#include <switchboard_core/Node.hpp>
12#include <switchboard_core/Parameter.hpp>
13#include <switchboard_core/SwitchboardCore.hpp>
14
15#include <any>
16#include <map>
17#include <string>
18#include <vector>
19
20namespace switchboard {
21
26class AudioNode : public Node {
27public:
34 AudioNode(const uint numberOfInputs, const uint numberOfOutputs);
35
39 virtual ~AudioNode() = default;
40
47 virtual std::string getDisplayName() const;
48
54 virtual std::vector<std::unique_ptr<Parameter>>& getParameters();
55
63 virtual Parameter* getParameter(const std::string& id);
64
65 // MARK: Overridden methods
66
67 Result<void> setValue(const std::string& key, const std::any& value) override;
68 Result<std::any> getValue(const std::string& key) override;
69 Result<std::any> callAction(const std::string& actionName, const std::map<std::string, std::any>& params) override;
70
71protected:
72 std::vector<std::unique_ptr<Parameter>> parameters;
73
79 void initParameters(const std::map<std::string, std::any>& config);
80};
81
82}
void initParameters(const std::map< std::string, std::any > &config)
Initializes the node parameters from the given configuration values.
virtual std::vector< std::unique_ptr< Parameter > > & getParameters()
Gets the parameters of the audio node.
virtual ~AudioNode()=default
AudioNode virtual destructor.
Result< std::any > callAction(const std::string &actionName, const std::map< std::string, std::any > &params) override
Calls an action on the object.
Result< std::any > getValue(const std::string &key) override
Gets a value from the object.
AudioNode(const uint numberOfInputs, const uint numberOfOutputs)
AudioNode constructor.
virtual Parameter * getParameter(const std::string &id)
Gets the parameter with the given name.
virtual std::string getDisplayName() const
Gets the display name of the audio node.
Result< void > setValue(const std::string &key, const std::any &value) override
Sets a value on the object.
Node(const uint numberOfInputs, const uint numberOfOutputs)
Node constructor.
Parameter class. Represents an adjustable config value in an audio node.
Definition Parameter.hpp:20