diff options
Diffstat (limited to 'src/libs/client')
-rw-r--r-- | src/libs/client/ControlModel.hpp | 56 | ||||
-rw-r--r-- | src/libs/client/DeprecatedLoader.cpp | 60 | ||||
-rw-r--r-- | src/libs/client/DeprecatedLoader.hpp | 2 | ||||
-rw-r--r-- | src/libs/client/Makefile.am | 2 | ||||
-rw-r--r-- | src/libs/client/OSCClientReceiver.hpp | 1 | ||||
-rw-r--r-- | src/libs/client/PresetModel.hpp | 72 |
6 files changed, 60 insertions, 133 deletions
diff --git a/src/libs/client/ControlModel.hpp b/src/libs/client/ControlModel.hpp deleted file mode 100644 index b2a192e4..00000000 --- a/src/libs/client/ControlModel.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License alongCont - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONTROLMODEL_H -#define CONTROLMODEL_H - -#include <string> -#include <raul/Path.hpp> - -namespace Ingen { -namespace Client { - - -/** A single port's control setting (in a preset). - * - * \ingroup IngenClient - */ -class ControlModel -{ -public: - ControlModel(const Path& port_path, float value) - : _port_path(port_path) - , _value(value) - { - assert(_port_path.find("//") == string::npos); - } - - const Path& port_path() const { return _port_path; } - void port_path(const string& p) { _port_path = p; } - float value() const { return _value; } - void value(float v) { _value = v; } - -private: - Path _port_path; - float _value; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // CONTROLMODEL diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index e5179fa0..d064830b 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -35,7 +35,6 @@ #include "NodeModel.hpp" #include "ConnectionModel.hpp" #include "PortModel.hpp" -#include "PresetModel.hpp" #include "PluginModel.hpp" #include "DeprecatedLoader.hpp" @@ -44,6 +43,65 @@ using namespace std; namespace Ingen { namespace Client { + +/** A single port's control setting (in a preset). + * + * \ingroup IngenClient + */ +class ControlModel +{ +public: + ControlModel(const Path& port_path, float value) + : _port_path(port_path) + , _value(value) + { + assert(_port_path.find("//") == string::npos); + } + + const Path& port_path() const { return _port_path; } + void port_path(const string& p) { _port_path = p; } + float value() const { return _value; } + void value(float v) { _value = v; } + +private: + Path _port_path; + float _value; +}; + + +/** Model of a preset (a collection of control settings). + * + * \ingroup IngenClient + */ +class PresetModel +{ +public: + PresetModel(const string& base_path) : _base_path(base_path) {} + + /** Add a control value to this preset. An empty string for a node_name + * means the port is on the patch itself (not a node in the patch). */ + void add_control(const string& node_name, string port_name, float value) { + if (port_name == "note_number") // FIXME: filthy kludge + port_name = "note"; + + if (node_name != "") + _controls.push_back(ControlModel(_base_path + node_name +"/"+ port_name, value)); + else + _controls.push_back(ControlModel(_base_path + port_name, value)); + } + + const string& name() const { return _name; } + void name(const string& n) { _name = n; } + + const list<ControlModel>& controls() const { return _controls; } + +private: + string _name; + string _base_path; + list<ControlModel> _controls; +}; + + string DeprecatedLoader::nameify_if_invalid(const string& name) { diff --git a/src/libs/client/DeprecatedLoader.hpp b/src/libs/client/DeprecatedLoader.hpp index 209e1f1c..c1af52c2 100644 --- a/src/libs/client/DeprecatedLoader.hpp +++ b/src/libs/client/DeprecatedLoader.hpp @@ -41,7 +41,7 @@ namespace Client { class PatchModel; class NodeModel; class ConnectionModel; -class PresetModel; +class PresetModel; // defined in DeprecatedLoader.cpp /** Loads deprecated (XML) patch files (from the Om days). diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index 6c55ab57..f111a54d 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -30,7 +30,6 @@ libingen_client_la_SOURCES = \ $(top_srcdir)/ingen/src/common/interface/ClientInterface.hpp \ $(top_srcdir)/ingen/src/common/interface/EngineInterface.hpp \ ConnectionModel.hpp \ - ControlModel.hpp \ DeprecatedLoader.cpp \ DeprecatedLoader.hpp \ NodeModel.cpp \ @@ -49,7 +48,6 @@ libingen_client_la_SOURCES = \ PluginUI.cpp \ PortModel.cpp \ PortModel.hpp \ - PresetModel.hpp \ SigClientInterface.hpp \ Store.cpp \ Store.hpp \ diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp index 8963d3ca..2dcc4906 100644 --- a/src/libs/client/OSCClientReceiver.hpp +++ b/src/libs/client/OSCClientReceiver.hpp @@ -29,7 +29,6 @@ namespace Ingen { namespace Client { //class NodeModel; -//class PresetModel; /* Some boilerplate killing macros... */ #define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg diff --git a/src/libs/client/PresetModel.hpp b/src/libs/client/PresetModel.hpp deleted file mode 100644 index 9bf0467b..00000000 --- a/src/libs/client/PresetModel.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details. - * - * You should have received a copy of the GNU General Public License alongCont - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PRESETMODEL_H -#define PRESETMODEL_H - -#include <string> -#include <list> -#include "ControlModel.hpp" - -using std::string; using std::list; - -namespace Ingen { -namespace Client { - - -/** Model of a preset (a collection of control settings). - * - * \ingroup IngenClient - */ -class PresetModel -{ -public: - PresetModel(const string& base_path) - : _base_path(base_path) - {} - - /** Add a control value to this preset. An empty string for a node_name - * means the port is on the patch itself (not a node in the patch). - */ - void add_control(const string& node_name, string port_name, float value) - { - // FIXME: filthy, filthy kludge for old Om patches - if (port_name == "note_number") - port_name = "note"; - - if (node_name != "") - _controls.push_back(ControlModel(_base_path + node_name +"/"+ port_name, value)); - else - _controls.push_back(ControlModel(_base_path + port_name, value)); - } - - const string& name() const { return _name; } - void name(const string& n) { _name = n; } - - const list<ControlModel>& controls() const { return _controls; } - -private: - string _name; - string _base_path; - list<ControlModel> _controls; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // PRESETMODEL |