summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/variant.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-28 15:50:57 -0500
committerDavid Robillard <d@drobilla.net>2014-12-28 16:06:44 -0500
commit4c0cebf7f98ecd14873d26b6f4d8bdedd37cb994 (patch)
tree8efbd17e96fc1c56392ff77e2ef3d99e5f3af731 /libs/ardour/ardour/variant.h
parentec947ff8fd2cf229284f757b8bd6b0f96cbd6383 (diff)
MIDI transform dialog.
Diffstat (limited to 'libs/ardour/ardour/variant.h')
-rw-r--r--libs/ardour/ardour/variant.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/ardour/ardour/variant.h b/libs/ardour/ardour/variant.h
index d99c0e4fd3..0402ffaa0b 100644
--- a/libs/ardour/ardour/variant.h
+++ b/libs/ardour/ardour/variant.h
@@ -49,7 +49,8 @@ public:
URI ///< URI string
};
- explicit Variant() : _type(NOTHING) { _long = 0; }
+ Variant() : _type(NOTHING) { _long = 0; }
+
explicit Variant(bool value) : _type(BOOL) { _bool = value; }
explicit Variant(double value) : _type(DOUBLE) { _double = value; }
explicit Variant(float value) : _type(FLOAT) { _float = value; }
@@ -92,6 +93,9 @@ public:
_long = (int64_t)lrint(std::max((double)INT64_MIN,
std::min(value, (double)INT64_MAX)));
break;
+ case BEATS:
+ _beats = Evoral::MusicalTime(value);
+ break;
default:
_type = NOTHING;
_long = 0;
@@ -106,6 +110,7 @@ public:
case FLOAT: return _float;
case INT: return _int;
case LONG: return _long;
+ case BEATS: return _beats.to_double();
default: return 0.0;
}
}
@@ -157,6 +162,8 @@ public:
return _type == BEATS && _beats == v;
}
+ bool operator!() const { return _type == NOTHING; }
+
Variant& operator=(Evoral::MusicalTime v) {
_type = BEATS;
_beats = v;
@@ -171,7 +178,7 @@ public:
static bool type_is_numeric(Type type) {
switch (type) {
- case BOOL: case DOUBLE: case FLOAT: case INT: case LONG:
+ case BOOL: case DOUBLE: case FLOAT: case INT: case LONG: case BEATS:
return true;
default:
return false;