summaryrefslogtreecommitdiffstats
path: root/ingen/client
diff options
context:
space:
mode:
Diffstat (limited to 'ingen/client')
-rw-r--r--ingen/client/BlockModel.hpp11
-rw-r--r--ingen/client/ParameterModel.hpp63
2 files changed, 72 insertions, 2 deletions
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