#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"
// 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();
}
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)
{
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 ();
}
}
- return value_as_string (value);
+ return ARDOUR::Panner::value_as_string (value);
}
private:
std::string get_label (int&);
- std::string value_as_string (double v) const;
};
#endif /* __gtk_ardour_panner_h__ */
return automation_control (Evoral::Parameter (PanAutomation, chan, id));
}
+ static std::string value_as_string (double);
+
private:
/* disallow copy construction */
Panner (Panner const &);
#include <locale.h>
#include <unistd.h>
#include <float.h>
+#include <iomanip>
#include <glibmm.h>
(*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 "";
+}