diff options
author | David Robillard <d@drobilla.net> | 2016-09-18 21:36:48 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-09-18 21:40:46 -0400 |
commit | bb64f80bb139314a06e0b22fddbea7a330b6e149 (patch) | |
tree | 51e78a387bc8f1df6ecff3c1799ae7f0dc3f2bdc /ingen | |
parent | 01deca45d8aa5fbfff75e204cd248a9dd79ab041 (diff) | |
download | ingen-bb64f80bb139314a06e0b22fddbea7a330b6e149.tar.gz ingen-bb64f80bb139314a06e0b22fddbea7a330b6e149.tar.bz2 ingen-bb64f80bb139314a06e0b22fddbea7a330b6e149.zip |
Preliminary parameter support workparameters
Diffstat (limited to 'ingen')
-rw-r--r-- | ingen/Node.hpp | 3 | ||||
-rw-r--r-- | ingen/Resource.hpp | 1 | ||||
-rw-r--r-- | ingen/URIs.hpp | 4 | ||||
-rw-r--r-- | ingen/client/BlockModel.hpp | 11 | ||||
-rw-r--r-- | ingen/client/ParameterModel.hpp | 63 | ||||
-rw-r--r-- | ingen/ingen.h | 1 |
6 files changed, 80 insertions, 3 deletions
diff --git a/ingen/Node.hpp b/ingen/Node.hpp index fb5fc985..c5b905bd 100644 --- a/ingen/Node.hpp +++ b/ingen/Node.hpp @@ -52,7 +52,8 @@ public: enum class GraphType { GRAPH, BLOCK, - PORT + PORT, + PARAMETER }; typedef std::pair<const Node*, const Node*> ArcsKey; diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp index 604428ce..ddb3078a 100644 --- a/ingen/Resource.hpp +++ b/ingen/Resource.hpp @@ -240,6 +240,7 @@ public: bool& graph, bool& block, bool& port, + bool& parameter, bool& is_output); virtual void set_uri(const Raul::URI& uri) { _uri = uri; } diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index 9fc771da..1a05ab2d 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -105,6 +105,7 @@ public: const Quark ingen_Graph; const Quark ingen_GraphPrototype; const Quark ingen_Internal; + const Quark ingen_Parameter; const Quark ingen_Redo; const Quark ingen_Undo; const Quark ingen_activity; @@ -183,17 +184,20 @@ public: const Quark patch_body; const Quark patch_destination; const Quark patch_property; + const Quark patch_readable; const Quark patch_remove; const Quark patch_sequenceNumber; const Quark patch_subject; const Quark patch_value; const Quark patch_wildcard; + const Quark patch_writable; const Quark pprops_logarithmic; const Quark pset_Preset; const Quark pset_preset; const Quark rdf_type; const Quark rdfs_Class; const Quark rdfs_label; + const Quark rdfs_range; const Quark rdfs_seeAlso; const Quark rsz_minimumSize; const Quark state_loadDefaultState; diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index e689414c..a9474671 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -36,8 +36,9 @@ class URIs; namespace Client { -class PluginModel; class ClientStore; +class ParameterModel; +class PluginModel; /** Block model class, used by the client to store engine's state. * @@ -51,7 +52,8 @@ public: GraphType graph_type() const { return Node::GraphType::BLOCK; } - typedef std::vector< SPtr<const PortModel> > Ports; + typedef std::vector< SPtr<const PortModel> > Ports; + typedef std::vector< SPtr<const ParameterModel> > Parameters; SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; SPtr<const PortModel> get_port(uint32_t index) const; @@ -64,6 +66,7 @@ public: SPtr<PluginModel> plugin_model() const { return _plugin; } uint32_t num_ports() const { return _ports.size(); } const Ports& ports() const { return _ports; } + const Parameters& parameters() const { return _parameters; } void default_port_value_range(SPtr<const PortModel> port, float& min, @@ -81,6 +84,8 @@ public: // Signals INGEN_SIGNAL(new_port, void, SPtr<const PortModel>); INGEN_SIGNAL(removed_port, void, SPtr<const PortModel>); + INGEN_SIGNAL(new_parameter, void, SPtr<const ParameterModel>); + INGEN_SIGNAL(removed_parameter, void, SPtr<const ParameterModel>); protected: friend class ClientStore; @@ -98,11 +103,13 @@ protected: void add_port(SPtr<PortModel> pm); void remove_port(SPtr<PortModel> pm); void remove_port(const Raul::Path& port_path); + void add_parameter(SPtr<ParameterModel> pm); void set(SPtr<ObjectModel> model); virtual void clear(); Ports _ports; ///< Vector of ports + Parameters _parameters; ///< Vector of parameters Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) SPtr<PluginModel> _plugin; ///< The plugin this block is an instance of diff --git a/ingen/client/ParameterModel.hpp b/ingen/client/ParameterModel.hpp new file mode 100644 index 00000000..692c0108 --- /dev/null +++ b/ingen/client/ParameterModel.hpp @@ -0,0 +1,63 @@ +/* + This file is part of Ingen. + Copyright 2016 David Robillard <http://drobilla.net/> + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef INGEN_CLIENT_PARAMETERMODEL_HPP +#define INGEN_CLIENT_PARAMETERMODEL_HPP + +#include <cstdlib> +#include <string> + +#include "ingen/client/ObjectModel.hpp" + +namespace Raul { class Path; } + +namespace Ingen { +namespace Client { + +/** Model of a parameter. + * + * @ingroup IngenClient + */ +class INGEN_API ParameterModel : public ObjectModel +{ +public: + GraphType graph_type() const { return Node::GraphType::PARAMETER; } + + inline const Atom& value() const { return get_property(_uris.ingen_value); } + inline bool is_input() const { return true; } + inline bool is_output() const { return true; } + + inline bool operator==(const ParameterModel& pm) const { return (path() == pm.path()); } + + void on_property(const Raul::URI& uri, const Atom& value) {} + + INGEN_SIGNAL(value_changed, void, const Atom&); + +private: + friend class ClientStore; + + ParameterModel(URIs& uris, + const Raul::Path& path) + : ObjectModel(uris, path) + {} + + void set(SPtr<ObjectModel> model) {} +}; + +} // namespace Client +} // namespace Ingen + +#endif // INGEN_CLIENT_PARAMETERMODEL_HPP diff --git a/ingen/ingen.h b/ingen/ingen.h index 3af2042c..f1735f32 100644 --- a/ingen/ingen.h +++ b/ingen/ingen.h @@ -44,6 +44,7 @@ #define INGEN__GraphPrototype INGEN_NS "GraphPrototype" #define INGEN__Internal INGEN_NS "Internal" #define INGEN__Node INGEN_NS "Node" +#define INGEN__Parameter INGEN_NS "Parameter" #define INGEN__Plugin INGEN_NS "Plugin" #define INGEN__Redo INGEN_NS "Redo" #define INGEN__Undo INGEN_NS "Undo" |