X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fevoral%2Fevoral%2FParameter.hpp;h=2164475cf9635f34e73567b08031f4fb94a5815a;hb=2a7ed69c28c5c4606ff13b3605b9bc9c3eba607d;hp=35fae2dee21815bb1302dfe3356efea2a396f070;hpb=0e1c62150a385d7c4259b7e2cd2885392badeed3;p=ardour.git diff --git a/libs/evoral/evoral/Parameter.hpp b/libs/evoral/evoral/Parameter.hpp index 35fae2dee2..2164475cf9 100644 --- a/libs/evoral/evoral/Parameter.hpp +++ b/libs/evoral/evoral/Parameter.hpp @@ -1,6 +1,5 @@ - /* This file is part of Evoral. - * Copyright (C) 2008 Dave Robillard + * Copyright (C) 2008 David Robillard * Copyright (C) 2000-2008 Paul Davis * * Evoral is free software; you can redistribute it and/or modify it under the @@ -25,6 +24,8 @@ #include #include +#include "evoral/visibility.h" + namespace Evoral { @@ -37,7 +38,7 @@ namespace Evoral { * This class defines a < operator which is a strict weak ordering, so * Parameter may be stored in a std::set, used as a std::map key, etc. */ -class Parameter +class LIBEVORAL_API Parameter { public: Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) @@ -61,33 +62,7 @@ public: /** Strict weak ordering * See: http://www.sgi.com/tech/stl/StrictWeakOrdering.html - * Sort Parameters first according to type then to id and lastly to channel. - * - * Proof: - *
    - *
  1. Irreflexivity: f(x, x) is false because of the irreflexivity of \c < in each branch.
  2. - *
  3. Antisymmetry: given x != y, f(x, y) implies !f(y, x) because of the same - * property of \c < in each branch and the symmetry of operator==.
  4. - *
  5. Transitivity: let f(x, y) and f(y, z) => f(x, z) be true. - * We prove by contradiction, assuming the contrary: - * f(x, y) and f(x, z) hold => !f(x, z) - * - * That implies one of the following: - *
      - *
    1. x == z which contradicts the assumption f(x, y) and f(y, x) - * because of antisymmetry. - *
    2. - *
    3. f(z, x) is true. That would imply that one of the ivars (we call it i) - * of x is greater than the same ivar in z while all "previous" ivars - * are equal. That would imply that also in y all those "previous" - * ivars are equal and because if x.i > z.i it is impossible - * that there is an y that satisfies x.i < y.i < z.i at the same - * time which contradicts the assumption. - *
    4. - * Therefore f(x, z) is true (transitivity) - *
    - *
  6. - *
+ * Sort Parameters first according to type then to channel and lastly to ID. */ inline bool operator<(const Parameter& other) const { if (_type < other._type) { @@ -105,20 +80,21 @@ public: /** Not used in indentity/comparison */ struct Metadata { - Metadata(double low=0.0, double high=1.0, double mid=0.0) - : min(low), max(high), normal(mid) + Metadata(double low=0.0, double high=1.0, double mid=0.0, bool tog=false) + : min(low), max(high), normal(mid), toggled(tog) {} double min; double max; double normal; + bool toggled; }; - inline static void set_range(uint32_t type, double min, double max, double normal) { - _type_metadata[type] = Metadata(min, max, normal); + inline static void set_range(uint32_t type, double min, double max, double normal, bool toggled) { + _type_metadata[type] = Metadata(min, max, normal, toggled); } - inline void set_range(double min, double max, double normal) { - _metadata = boost::shared_ptr(new Metadata(min, max, normal)); + inline void set_range(double min, double max, double normal, bool toggled) { + _metadata = boost::shared_ptr(new Metadata(min, max, normal, toggled)); } inline Metadata& metadata() const { @@ -128,9 +104,10 @@ public: return _type_metadata[_type]; } - inline double min() const { return metadata().min; } - inline double max() const { return metadata().max; } - inline double normal() const { return metadata().normal; } + inline double min() const { return metadata().min; } + inline double max() const { return metadata().max; } + inline double normal() const { return metadata().normal; } + inline double toggled() const { return metadata().toggled; } protected: // Default copy constructor is ok