summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
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/ardour/ardour
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/ardour/ardour')
-rw-r--r--libs/ardour/ardour/automation_list.h6
-rw-r--r--libs/ardour/ardour/event_type_map.h19
-rw-r--r--libs/ardour/ardour/parameter_descriptor.h76
3 files changed, 24 insertions, 77 deletions
diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h
index 28f9be3fd4..cfeaeafa86 100644
--- a/libs/ardour/ardour/automation_list.h
+++ b/libs/ardour/ardour/automation_list.h
@@ -64,13 +64,15 @@ private:
class LIBARDOUR_API AutomationList : public PBD::StatefulDestructible, public Evoral::ControlList
{
public:
- AutomationList (Evoral::Parameter id);
+ AutomationList (const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc);
+ AutomationList (const Evoral::Parameter& id);
AutomationList (const XMLNode&, Evoral::Parameter id);
AutomationList (const AutomationList&);
AutomationList (const AutomationList&, double start, double end);
~AutomationList();
- virtual boost::shared_ptr<Evoral::ControlList> create(Evoral::Parameter id);
+ virtual boost::shared_ptr<ControlList> create(const Evoral::Parameter& id,
+ const Evoral::ParameterDescriptor& desc);
AutomationList& operator= (const AutomationList&);
diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h
index f69d20b773..0d7e623754 100644
--- a/libs/ardour/ardour/event_type_map.h
+++ b/libs/ardour/ardour/event_type_map.h
@@ -21,9 +21,12 @@
#ifndef __ardour_event_type_map_h__
#define __ardour_event_type_map_h__
+#include <map>
#include <string>
+
#include "evoral/TypeMap.hpp"
#include "evoral/ControlList.hpp"
+#include "evoral/ParameterDescriptor.hpp"
#include "ardour/libardour_visibility.h"
@@ -43,19 +46,23 @@ public:
uint32_t midi_event_type(uint8_t status) const;
Evoral::ControlList::InterpolationStyle interpolation_of(const Evoral::Parameter& param);
- bool is_integer(const Evoral::Parameter& param) const;
- Evoral::Parameter new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const;
- Evoral::Parameter new_parameter(const std::string& str) const;
- std::string to_symbol(const Evoral::Parameter& param) const;
+ Evoral::Parameter from_symbol(const std::string& str) const;
+ std::string to_symbol(const Evoral::Parameter& param) const;
+
+ const Evoral::ParameterDescriptor& descriptor(const Evoral::Parameter& param) const;
- bool is_midi_parameter(const Evoral::Parameter& param);
+ void set_descriptor(const Evoral::Parameter& param,
+ const Evoral::ParameterDescriptor& desc);
URIMap& uri_map() { return _uri_map; }
private:
+ typedef std::map<Evoral::Parameter, Evoral::ParameterDescriptor> Descriptors;
+
EventTypeMap(URIMap& uri_map) : _uri_map(uri_map) {}
- URIMap& _uri_map;
+ URIMap& _uri_map;
+ Descriptors _descriptors;
static EventTypeMap* event_type_map;
};
diff --git a/libs/ardour/ardour/parameter_descriptor.h b/libs/ardour/ardour/parameter_descriptor.h
index 41b1f031d1..d4bef550f5 100644
--- a/libs/ardour/ardour/parameter_descriptor.h
+++ b/libs/ardour/ardour/parameter_descriptor.h
@@ -21,7 +21,9 @@
#define __ardour_parameter_descriptor_h__
#include "ardour/variant.h"
+
#include "evoral/Parameter.hpp"
+#include "evoral/ParameterDescriptor.hpp"
namespace ARDOUR {
@@ -31,7 +33,7 @@ typedef std::map<const std::string, const float> ScalePoints;
*
* Essentially a union of LADSPA, VST and LV2 info.
*/
-struct ParameterDescriptor
+struct ParameterDescriptor : public Evoral::ParameterDescriptor
{
enum Unit {
NONE, ///< No unit
@@ -40,72 +42,12 @@ struct ParameterDescriptor
HZ, ///< Frequency in Hertz
};
- ParameterDescriptor(const Evoral::Parameter& parameter)
- : key((uint32_t)-1)
- , datatype(Variant::NOTHING)
- , unit(NONE)
- , normal(parameter.normal())
- , lower(parameter.min())
- , upper(parameter.max())
- , step(0)
- , smallstep(0)
- , largestep(0)
- , integer_step(parameter.type() >= MidiCCAutomation &&
- parameter.type() <= MidiChannelPressureAutomation)
- , toggled(parameter.toggled())
- , logarithmic(false)
- , sr_dependent(false)
- , min_unbound(0)
- , max_unbound(0)
- , enumeration(false)
- {
- if (parameter.type() == GainAutomation) {
- unit = DB;
- }
- update_steps();
- }
-
- ParameterDescriptor()
- : key((uint32_t)-1)
- , datatype(Variant::NOTHING)
- , unit(NONE)
- , normal(0)
- , lower(0)
- , upper(0)
- , step(0)
- , smallstep(0)
- , largestep(0)
- , integer_step(false)
- , toggled(false)
- , logarithmic(false)
- , sr_dependent(false)
- , min_unbound(0)
- , max_unbound(0)
- , enumeration(false)
- {}
-
- /* Set step, smallstep, and largestep, based on current description */
- void update_steps() {
- if (unit == ParameterDescriptor::MIDI_NOTE) {
- step = smallstep = 1; // semitone
- largestep = 12; // octave
- } else if (integer_step) {
- const float delta = upper - lower;
+ ParameterDescriptor(const Evoral::Parameter& parameter);
- smallstep = delta / 10000.0f;
- step = delta / 1000.0f;
- largestep = delta / 40.0f;
+ ParameterDescriptor();
- smallstep = std::max(1.0, rint(smallstep));
- step = std::max(1.0, rint(step));
- largestep = std::max(1.0, rint(largestep));
- }
- /* else: leave all others as default '0'
- * in that case the UI (eg. AutomationController::create)
- * uses internal_to_interface() to map the value
- * to an appropriate interface range
- */
- }
+ /** Set step, smallstep, and largestep, based on current description. */
+ void update_steps();
std::string label;
std::string print_fmt; ///< format string for pretty printing
@@ -113,14 +55,10 @@ struct ParameterDescriptor
uint32_t key; ///< for properties
Variant::Type datatype; ///< for properties
Unit unit;
- float normal;
- float lower; ///< for frequencies, this is in Hz (not a fraction of the sample rate)
- float upper; ///< for frequencies, this is in Hz (not a fraction of the sample rate)
float step;
float smallstep;
float largestep;
bool integer_step;
- bool toggled;
bool logarithmic;
bool sr_dependent;
bool min_unbound;