change Controllable::set_value() API to include grouped control consideration.
[ardour.git] / libs / surfaces / mackie / controls.cc
index f5df04be4a4962f63107af1556456d9d05eeaf07..8ed0bad3114f1463a929b096d2c70939395eca19 100644 (file)
 #include "meter.h"
 
 
-using namespace Mackie;
 using namespace std;
+using namespace ArdourSurface;
+using namespace Mackie;
+
 using ARDOUR::AutomationControl;
 
 void Group::add (Control& control)
@@ -69,81 +71,56 @@ Control::set_in_use (bool in_use)
        _in_use = in_use;
 }
 
-ostream & Mackie::operator <<  (ostream & os, const Mackie::Control & control)
-{
-       os << typeid (control).name();
-       os << " { ";
-       os << "name: " << control.name();
-       os << ", ";
-       os << "id: " << "0x" << setw(2) << setfill('0') << hex << control.id() << setfill(' ');
-       os << ", ";
-       os << "group: " << control.group().name();
-       os << " }";
-       
-       return os;
-}
-
-Control*
-Jog::factory (Surface& surface, int id, const char* name, Group& group)
-{
-       Jog* j = new Jog (id, name, group);
-       surface.controls.push_back (j);
-       surface.controls_by_name["jog"] = j;
-       group.add (*j);
-       return j;
-}
-
 void
-Control::set_normal_control (boost::shared_ptr<AutomationControl> ac)
+Control::set_control (boost::shared_ptr<AutomationControl> ac)
 {
        normal_ac = ac;
 }
 
 void
-Control::set_modified_control (boost::shared_ptr<AutomationControl> ac)
-{
-       modified_ac = ac;
-}
-
-void
-Control::set_value (float val, bool modified)
+Control::set_value (float val)
 {
-       if (modified && modified_ac) {
-               modified_ac->set_value (modified_ac->interface_to_internal (val));
-       } else if (normal_ac) {
-               normal_ac->set_value (modified_ac->interface_to_internal (val));
+       if (normal_ac) {
+               normal_ac->set_value (normal_ac->interface_to_internal (val), PBD::Controllable::NoGroup);
        }
 }
 
 float
-Control::get_value (bool modified)
+Control::get_value ()
 {
-       if (modified && modified_ac) {
-               return modified_ac->internal_to_interface (modified_ac->get_value());
-       } else if (normal_ac) {
-               return normal_ac->internal_to_interface (normal_ac->get_value());
+       if (!normal_ac) {
+               return 0.0f;
        }
-
-       return 0.0;
+       return normal_ac->internal_to_interface (normal_ac->get_value());
 }
 
 void
-Control::start_touch (double when, bool modified)
+Control::start_touch (double when)
 {
-       if (modified && modified_ac) {
-               return modified_ac->start_touch (when);
-       } else if (normal_ac) {
+       if (normal_ac) {
                return normal_ac->start_touch (when);
        }
 }
-       
+
 void
-Control::stop_touch (double when, bool mark, bool modified)
+Control::stop_touch (bool mark, double when)
 {
-       if (modified && modified_ac) {
-               return modified_ac->stop_touch (when, mark);
-       } else if (normal_ac) {
-               return normal_ac->stop_touch (when, mark);
+       if (normal_ac) {
+               return normal_ac->stop_touch (mark, when);
        }
 }
-       
+
+ostream & operator <<  (ostream & os, const ArdourSurface::Mackie::Control & control)
+{
+       os << typeid (control).name();
+       os << " { ";
+       os << "name: " << control.name();
+       os << ", ";
+       os << "id: " << "0x" << setw(2) << setfill('0') << hex << control.id() << setfill(' ');
+       os << ", ";
+       os << "group: " << control.group().name();
+       os << " }";
+
+       return os;
+}
+