summaryrefslogtreecommitdiff
path: root/libs/evoral/evoral/Parameter.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-01 14:28:03 -0500
committerDavid Robillard <d@drobilla.net>2014-12-01 23:35:24 -0500
commit767c0238a34ef4acc4d345e88cd5ddb0c8a8e421 (patch)
treefed11fb6f4e4e08a7c35eb45f53aea70dc66e4f8 /libs/evoral/evoral/Parameter.hpp
parentcb8abbe8d2f0e4dfe52bd35613ebba7689628eca (diff)
Replace half-baked param metadata with descriptor.
Among other things, this means that automation controls/lists have the actual min/max/normal/toggled of parameters, and not those inferred from the Parameter ID, which is not correct for things like plugin parameters. Pushing things down to the Evoral::ParmeterDescriptor may be useful in the future to have lists do smarter things based on parameter range, but currently I have just pushed down the above-mentioned currently used attributes.
Diffstat (limited to 'libs/evoral/evoral/Parameter.hpp')
-rw-r--r--libs/evoral/evoral/Parameter.hpp47
1 files changed, 2 insertions, 45 deletions
diff --git a/libs/evoral/evoral/Parameter.hpp b/libs/evoral/evoral/Parameter.hpp
index 2164475cf9..c870fa8e99 100644
--- a/libs/evoral/evoral/Parameter.hpp
+++ b/libs/evoral/evoral/Parameter.hpp
@@ -28,7 +28,6 @@
namespace Evoral {
-
/** ID of a [play|record|automate]able parameter.
*
* A parameter is defined by (type, id, channel). Type is an integer which
@@ -41,12 +40,10 @@ namespace Evoral {
class LIBEVORAL_API Parameter
{
public:
- Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0)
+ inline Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0)
: _type(type), _id(id), _channel(channel)
{}
- virtual ~Parameter() {}
-
inline uint32_t type() const { return _type; }
inline uint8_t channel() const { return _channel; }
inline uint32_t id() const { return _id; }
@@ -78,52 +75,12 @@ public:
inline operator bool() const { return (_type != 0); }
- /** Not used in indentity/comparison */
- struct Metadata {
- 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, bool toggled) {
- _type_metadata[type] = Metadata(min, max, normal, toggled);
- }
-
- inline void set_range(double min, double max, double normal, bool toggled) {
- _metadata = boost::shared_ptr<Metadata>(new Metadata(min, max, normal, toggled));
- }
-
- inline Metadata& metadata() const {
- if (_metadata)
- return *_metadata.get();
- else
- 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 toggled() const { return metadata().toggled; }
-
-protected:
- // Default copy constructor is ok
-
- // ID (used in comparison)
+private:
uint32_t _type;
uint32_t _id;
uint8_t _channel;
-
- boost::shared_ptr<Metadata> _metadata;
-
- typedef std::map<uint32_t, Metadata> TypeMetadata;
- static TypeMetadata _type_metadata;
};
-
} // namespace Evoral
#endif // EVORAL_PARAMETER_HPP