mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 22:26:29 +01:00
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
This commit is contained in:
parent
85e8be3fa4
commit
d116af22db
16 changed files with 122 additions and 20 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ class BarController : public Gtk::Frame
|
|||
Gtk::SpinButton spinner;
|
||||
bool use_parent;
|
||||
bool logarithmic;
|
||||
sigc::slot<std::string> _label_slot;
|
||||
bool _use_slot;
|
||||
|
||||
virtual std::string get_label (int& /*x*/) {
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue