*/
-#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#include <cmath>
#include <locale.h>
#include <unistd.h>
#include <float.h>
+#include <iomanip>
#include <glibmm.h>
}
void
-Panner::PanControllable::set_value (float val)
+Panner::PanControllable::set_value (double val)
{
panner.streampanner (parameter().id()).set_position (direct_control_to_pan (val));
AutomationControl::set_value(val);
}
-float
+double
Panner::PanControllable::get_value (void) const
{
return AutomationControl::get_value();
if ((prop = node.property (X_("mono")))) {
set_mono (string_is_affirmative (prop->value()));
}
-
+
return 0;
}
Panner::Panner (string name, Session& s)
: SessionObject (s, name)
- , AutomatableControls (s)
+ , Automatable (s)
{
//set_name_old_auto (name);
set_name (name);
node->add_child_nocopy ((*i)->state (full));
}
+ node->add_child_nocopy (get_automation_xml_state ());
return *node;
}
automation_path = Glib::build_filename(_session.automation_dir(), prop->value ());
}
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((*niter)->name() == X_("Automation")) {
+ set_automation_xml_state (**niter, Evoral::Parameter (PanAutomation));
+ }
+ }
+
return 0;
}
}
void
-Panner::run (BufferSet& inbufs, BufferSet& outbufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+Panner::run (BufferSet& inbufs, BufferSet& outbufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes)
{
if (outbufs.count().n_audio() == 0) {
// Failing to deliver audio we were asked to deliver is a bug
(*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 "";
+}