diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-01-27 18:48:33 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-01-27 18:48:33 +0000 |
commit | d116af22db3c0e0cf6aeff6194a689d8bfad7c8c (patch) | |
tree | c3d9888d5020d8e6bf02532ea06adc388d9033f5 /libs/panners | |
parent | 85e8be3fa4f4910907d731a4591bf5e7d5135ca6 (diff) |
virtualize the way that AutomationController gets strings to display values, so that we can callback through the owner of an AutomationControl, not just rely on the value from the AutomationControl; make pan automation tracks use this to display more audio-centric values
git-svn-id: svn://localhost/ardour2/branches/3.0@8590 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/panners')
-rw-r--r-- | libs/panners/1in2out/panner_1in2out.cc | 24 | ||||
-rw-r--r-- | libs/panners/1in2out/panner_1in2out.h | 1 | ||||
-rw-r--r-- | libs/panners/2in2out/panner_2in2out.cc | 27 | ||||
-rw-r--r-- | libs/panners/2in2out/panner_2in2out.h | 1 | ||||
-rw-r--r-- | libs/panners/vbap/vbap.cc | 18 | ||||
-rw-r--r-- | libs/panners/vbap/vbap.h | 1 |
6 files changed, 72 insertions, 0 deletions
diff --git a/libs/panners/1in2out/panner_1in2out.cc b/libs/panners/1in2out/panner_1in2out.cc index 7a59aa04cc..cce2ec9b71 100644 --- a/libs/panners/1in2out/panner_1in2out.cc +++ b/libs/panners/1in2out/panner_1in2out.cc @@ -362,3 +362,27 @@ Panner1in2out::describe_parameter (Evoral::Parameter p) return _pannable->describe_parameter (p); } } + +string +Panner1in2out::value_as_string (boost::shared_ptr<AutomationControl> ac) const +{ + /* DO NOT USE LocaleGuard HERE */ + double val = ac->get_value(); + + switch (ac->parameter().type()) { + case PanAzimuthAutomation: + /* We show the position of the center of the image relative to the left & right. + This is expressed as a pair of percentage values that ranges from (100,0) + (hard left) through (50,50) (hard center) to (0,100) (hard right). + + This is pretty wierd, but its the way audio engineers expect it. Just remember that + the center of the USA isn't Kansas, its (50LA, 50NY) and it will all make sense. + */ + + return string_compose (_("L:%1 R:%2"), (int) rint (100.0 * (1.0 - val)), + (int) rint (100.0 * val)); + + default: + return _pannable->value_as_string (ac); + } +} diff --git a/libs/panners/1in2out/panner_1in2out.h b/libs/panners/1in2out/panner_1in2out.h index ced467c11b..ffc67ac54d 100644 --- a/libs/panners/1in2out/panner_1in2out.h +++ b/libs/panners/1in2out/panner_1in2out.h @@ -60,6 +60,7 @@ class Panner1in2out : public Panner static Panner* factory (boost::shared_ptr<Pannable>, Speakers&); std::string describe_parameter (Evoral::Parameter); + std::string value_as_string (boost::shared_ptr<AutomationControl>) const; XMLNode& state (bool full_state); XMLNode& get_state (void); diff --git a/libs/panners/2in2out/panner_2in2out.cc b/libs/panners/2in2out/panner_2in2out.cc index 2c2856361c..30d971d118 100644 --- a/libs/panners/2in2out/panner_2in2out.cc +++ b/libs/panners/2in2out/panner_2in2out.cc @@ -473,3 +473,30 @@ Panner2in2out::describe_parameter (Evoral::Parameter p) return _pannable->describe_parameter (p); } } + +string +Panner2in2out::value_as_string (boost::shared_ptr<AutomationControl> ac) const +{ + /* DO NOT USE LocaleGuard HERE */ + double val = ac->get_value(); + + switch (ac->parameter().type()) { + case PanAzimuthAutomation: + /* We show the position of the center of the image relative to the left & right. + This is expressed as a pair of percentage values that ranges from (100,0) + (hard left) through (50,50) (hard center) to (0,100) (hard right). + + This is pretty wierd, but its the way audio engineers expect it. Just remember that + the center of the USA isn't Kansas, its (50LA, 50NY) and it will all make sense. + */ + + return string_compose (_("L:%1 R:%2"), (int) rint (100.0 * (1.0 - val)), + (int) rint (100.0 * val)); + + case PanWidthAutomation: + return string_compose (_("Width: %1%%"), (int) floor (100.0 * val)); + + default: + return _pannable->value_as_string (ac); + } +} diff --git a/libs/panners/2in2out/panner_2in2out.h b/libs/panners/2in2out/panner_2in2out.h index 0bb38fa27f..2014bb032e 100644 --- a/libs/panners/2in2out/panner_2in2out.h +++ b/libs/panners/2in2out/panner_2in2out.h @@ -60,6 +60,7 @@ class Panner2in2out : public Panner static Panner* factory (boost::shared_ptr<Pannable>, Speakers&); std::string describe_parameter (Evoral::Parameter); + std::string value_as_string (boost::shared_ptr<AutomationControl>) const; XMLNode& state (bool full_state); XMLNode& get_state (void); diff --git a/libs/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc index 6088a2d0d6..239a253f19 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -313,3 +313,21 @@ VBAPanner::describe_parameter (Evoral::Parameter p) return _pannable->describe_parameter (p); } } + +string +VBAPanner::value_as_string (boost::shared_ptr<AutomationControl> ac) const +{ + /* DO NOT USE LocaleGuard HERE */ + double val = ac->get_value(); + + switch (ac->parameter().type()) { + case PanAzimuthAutomation: /* direction */ + return string_compose (_("%1"), val * 360.0); + + case PanWidthAutomation: /* diffusion */ + return string_compose (_("%1%%"), (int) floor (100.0 * fabs(val))); + + default: + return _pannable->value_as_string (ac); + } +} diff --git a/libs/panners/vbap/vbap.h b/libs/panners/vbap/vbap.h index 2b80b032cb..cf010cc331 100644 --- a/libs/panners/vbap/vbap.h +++ b/libs/panners/vbap/vbap.h @@ -53,6 +53,7 @@ public: void set_azimuth_elevation (double azimuth, double elevation); std::string describe_parameter (Evoral::Parameter); + std::string value_as_string (boost::shared_ptr<AutomationControl>) const; XMLNode& state (bool full_state); XMLNode& get_state (); |