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/PortModel.h | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/libs/client/PortModel.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; }; -- cgit v1.2.1