Label panner automation sliders the same as panners.
git-svn-id: svn://localhost/ardour2/branches/3.0@7563 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "ardour/automation_control.h"
|
||||
#include "ardour/event_type_map.h"
|
||||
#include "ardour/automatable.h"
|
||||
#include "ardour/panner.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "utils.h"
|
||||
#include "automation_controller.h"
|
||||
@@ -85,6 +86,8 @@ AutomationController::get_label (int&)
|
||||
// Hack to display CC rounded to int
|
||||
if (_controllable->parameter().type() == MidiCCAutomation) {
|
||||
s << (int)_controllable->get_value();
|
||||
} else if (_controllable->parameter().type() == PanAutomation) {
|
||||
s << Panner::value_as_string (_controllable->get_value ());
|
||||
} else {
|
||||
s << std::fixed << std::setprecision(3) << _controllable->get_value();
|
||||
}
|
||||
|
||||
@@ -164,32 +164,10 @@ bool
|
||||
PannerBar::entry_output ()
|
||||
{
|
||||
Entry* e = dynamic_cast<Entry*> (&spinner);
|
||||
e->set_text (value_as_string (spinner.get_adjustment()->get_value()));
|
||||
e->set_text (ARDOUR::Panner::value_as_string (spinner.get_adjustment()->get_value()));
|
||||
return true;
|
||||
}
|
||||
|
||||
string
|
||||
PannerBar::value_as_string (double v) const
|
||||
{
|
||||
if (ARDOUR::Panner::equivalent (v, 0.5)) {
|
||||
return _("C");
|
||||
} else if (ARDOUR::Panner::equivalent (v, 0)) {
|
||||
return _("L");
|
||||
} else if (ARDOUR::Panner::equivalent (v, 1)) {
|
||||
return _("R");
|
||||
} else if (v < 0.5) {
|
||||
std::stringstream s;
|
||||
s << fixed << setprecision (0) << _("L") << ((0.5 - v) * 200) << "%";
|
||||
return s.str();
|
||||
} else if (v > 0.5) {
|
||||
std::stringstream s;
|
||||
s << fixed << setprecision (0) << _("R") << ((v -0.5) * 200) << "%";
|
||||
return s.str ();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string
|
||||
PannerBar::get_label (int& x)
|
||||
{
|
||||
@@ -209,7 +187,7 @@ PannerBar::get_label (int& x)
|
||||
|
||||
Glib::RefPtr<Pango::Context> p = get_pango_context ();
|
||||
Glib::RefPtr<Pango::Layout> l = Pango::Layout::create (p);
|
||||
l->set_text (value_as_string (value));
|
||||
l->set_text (ARDOUR::Panner::value_as_string (value));
|
||||
|
||||
Pango::Rectangle const ext = l->get_ink_extents ();
|
||||
|
||||
@@ -220,5 +198,5 @@ PannerBar::get_label (int& x)
|
||||
}
|
||||
}
|
||||
|
||||
return value_as_string (value);
|
||||
return ARDOUR::Panner::value_as_string (value);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ class PannerBar : public Gtkmm2ext::BarController
|
||||
|
||||
private:
|
||||
std::string get_label (int&);
|
||||
std::string value_as_string (double v) const;
|
||||
};
|
||||
|
||||
#endif /* __gtk_ardour_panner_h__ */
|
||||
|
||||
@@ -303,6 +303,8 @@ public:
|
||||
return automation_control (Evoral::Parameter (PanAutomation, chan, id));
|
||||
}
|
||||
|
||||
static std::string value_as_string (double);
|
||||
|
||||
private:
|
||||
/* disallow copy construction */
|
||||
Panner (Panner const &);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
#include <float.h>
|
||||
#include <iomanip>
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
@@ -1640,3 +1641,25 @@ Panner::set_mono (bool yn)
|
||||
(*i)->set_mono (yn);
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
Panner::value_as_string (double v)
|
||||
{
|
||||
if (Panner::equivalent (v, 0.5)) {
|
||||
return _("C");
|
||||
} else if (equivalent (v, 0)) {
|
||||
return _("L");
|
||||
} else if (equivalent (v, 1)) {
|
||||
return _("R");
|
||||
} else if (v < 0.5) {
|
||||
stringstream s;
|
||||
s << fixed << setprecision (0) << _("L") << ((0.5 - v) * 200) << "%";
|
||||
return s.str();
|
||||
} else {
|
||||
stringstream s;
|
||||
s << fixed << setprecision (0) << _("R") << ((v -0.5) * 200) << "%";
|
||||
return s.str ();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user