From 417623b0033b12969e4e84c61c21922d4ab7f534 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Jul 2007 03:58:49 +0000 Subject: Added metadata (ie integer, toggle) to builtin node control ports. Treat integer/toggle ports as.... integer ports (still with just a slider though). Closes ticket #40. git-svn-id: http://svn.drobilla.net/lad/ingen@571 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/Makefile.am | 1 + src/libs/client/PortModel.h | 26 +++++--------------------- src/libs/client/Serializer.cpp | 6 ++---- src/libs/client/Serializer.h | 1 - 4 files changed, 8 insertions(+), 26 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index 20822e8a..7250de36 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -35,6 +35,7 @@ libingen_client_la_SOURCES = \ NodeModel.h \ NodeModel.cpp \ PortModel.h \ + PortModel.cpp \ PatchModel.h \ PatchModel.cpp \ PluginModel.h \ diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h index 139e2a97..4dcf5e7f 100644 --- a/src/libs/client/PortModel.h +++ b/src/libs/client/PortModel.h @@ -41,9 +41,6 @@ class PortModel : public ObjectModel public: enum Direction { INPUT, OUTPUT }; - // FIXME: metadataify - enum Hint { NONE, INTEGER, TOGGLE, LOGARITHMIC }; - inline string type() const { return _type; } inline float value() const { return _current_val; } inline bool connected() const { return (_connections > 0); } @@ -52,10 +49,11 @@ public: inline bool is_audio() const { return (_type == "ingen:audio"); } inline bool is_control() const { return (_type == "ingen:control"); } inline bool is_midi() const { return (_type == "ingen:midi"); } - inline bool is_logarithmic() const { return (_hint == LOGARITHMIC); } - inline bool is_integer() const { return (_hint == INTEGER); } - inline bool is_toggle() const { return (_hint == TOGGLE); } + bool is_logarithmic() const; + bool is_integer() const; + bool is_toggle() const; + inline bool operator==(const PortModel& pm) const { return (_path == pm._path); } inline void value(float val) @@ -74,30 +72,17 @@ public: private: friend class Store; - PortModel(const Path& path, const string& type, Direction dir, Hint hint) - : ObjectModel(path), - _type(type), - _direction(dir), - _hint(hint), - _current_val(0.0f), - _connections(0) - { - if (!is_audio() && !is_control() && !is_input()) - cerr << "[PortModel] Warning: Unknown port type" << endl; - } - PortModel(const Path& path, const string& type, Direction dir) : ObjectModel(path), _type(type), _direction(dir), - _hint(NONE), _current_val(0.0f), _connections(0) { if (!is_audio() && !is_control() && !is_input()) cerr << "[PortModel] Warning: Unknown port type" << endl; } - + void add_child(SharedPtr c) { throw; } void remove_child(SharedPtr c) { throw; } @@ -106,7 +91,6 @@ private: string _type; Direction _direction; - Hint _hint; float _current_val; size_t _connections; }; diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index 92b0ad41..a1d5cc03 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -70,7 +70,6 @@ Serializer::start_to_filename(const string& filename) _base_uri = "file://" + filename; _model = new RDF::Model(_world); _mode = TO_FILE; - _filename = filename; } @@ -89,7 +88,6 @@ Serializer::start_to_string() _base_uri = ""; _model = new RDF::Model(_world); _mode = TO_STRING; - _filename = ""; } @@ -104,11 +102,11 @@ Serializer::finish() string ret = ""; if (_mode == TO_FILE) - _model->serialize_to_file(_filename); + _model->serialize_to_file(_base_uri); else ret = _model->serialize_to_string(); - _filename = ""; + _base_uri = ""; _node_map.clear(); return ret; diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h index ee7d3dff..6095cb25 100644 --- a/src/libs/client/Serializer.h +++ b/src/libs/client/Serializer.h @@ -73,7 +73,6 @@ private: typedef std::map NodeMap; Mode _mode; - std::string _filename; NodeMap _node_map; string _base_uri; Raul::RDF::World& _world; -- cgit v1.2.1