summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-01-27 18:48:33 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-01-27 18:48:33 +0000
commitd116af22db3c0e0cf6aeff6194a689d8bfad7c8c (patch)
treec3d9888d5020d8e6bf02532ea06adc388d9033f5 /libs/ardour
parent85e8be3fa4f4910907d731a4591bf5e7d5135ca6 (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/ardour')
-rw-r--r--libs/ardour/ardour/automatable.h1
-rw-r--r--libs/ardour/ardour/pannable.h2
-rw-r--r--libs/ardour/ardour/panner.h1
-rw-r--r--libs/ardour/automatable.cc20
-rw-r--r--libs/ardour/pannable.cc12
-rw-r--r--libs/ardour/panner.cc6
6 files changed, 40 insertions, 2 deletions
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index c9e900e6a9..1abfb4faf1 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -63,6 +63,7 @@ public:
virtual void transport_stopped (framepos_t now);
virtual std::string describe_parameter(Evoral::Parameter param);
+ virtual std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
AutoState get_parameter_automation_state (Evoral::Parameter param);
virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState);
diff --git a/libs/ardour/ardour/pannable.h b/libs/ardour/ardour/pannable.h
index dff64cec4b..3dc4ccb8fd 100644
--- a/libs/ardour/ardour/pannable.h
+++ b/libs/ardour/ardour/pannable.h
@@ -65,6 +65,8 @@ struct Pannable : public PBD::Stateful, public Automatable, public SessionHandle
return ((_auto_state & Write) || ((_auto_state & Touch) && touching()));
}
+ std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
+
void start_touch (double when);
void stop_touch (bool mark, double when);
bool touching() const { return g_atomic_int_get (&_touching); }
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h
index f43be2dbbc..c26d1a6a2c 100644
--- a/libs/ardour/ardour/panner.h
+++ b/libs/ardour/ardour/panner.h
@@ -93,6 +93,7 @@ class Panner : public PBD::Stateful, public PBD::ScopedConnectionList
virtual std::set<Evoral::Parameter> what_can_be_automated() const;
virtual std::string describe_parameter (Evoral::Parameter);
+ virtual std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
bool touching() const;
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 0d24135710..20dc910f61 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -492,3 +492,23 @@ Automatable::clear_controls ()
_control_connections.drop_connections ();
ControlSet::clear_controls ();
}
+
+string
+Automatable::value_as_string (boost::shared_ptr<AutomationControl> ac) const
+{
+ std::stringstream s;
+
+ /* this is a the default fallback for this virtual method. Derived Automatables
+ are free to override this to display the values of their parameters/controls
+ in different ways.
+ */
+
+ // Hack to display CC as integer value, rather than double
+ if (ac->parameter().type() == MidiCCAutomation) {
+ s << lrint (ac->get_value());
+ } else {
+ s << std::fixed << std::setprecision(3) << ac->get_value();
+ }
+
+ return s.str ();
+}
diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc
index 4243ab45df..1e2d5f5594 100644
--- a/libs/ardour/pannable.cc
+++ b/libs/ardour/pannable.cc
@@ -23,9 +23,11 @@
#include "ardour/automation_control.h"
#include "ardour/automation_list.h"
#include "ardour/pannable.h"
+#include "ardour/panner.h"
#include "ardour/pan_controllable.h"
#include "ardour/session.h"
+using namespace std;
using namespace PBD;
using namespace ARDOUR;
@@ -245,6 +247,12 @@ Pannable::set_state (const XMLNode& root, int /*version - not used*/)
return 0;
}
+string
+Pannable::value_as_string (boost::shared_ptr<AutomationControl> ac) const
+{
+ if (_panner) {
+ return _panner->value_as_string (ac);
+ }
-
-
+ return Automatable::value_as_string (ac);
+}
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index bfee68a342..1cb5e310aa 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -161,3 +161,9 @@ Panner::describe_parameter (Evoral::Parameter p)
{
return _pannable->describe_parameter (p);
}
+
+string
+Panner::value_as_string (boost::shared_ptr<AutomationControl> ac) const
+{
+ return _pannable->value_as_string (ac);
+}