X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Fcontrols.cc;h=1c88c2b74cfa1a285b8333cbcda5825d399dd5e8;hb=05a8107ff689284c22b2a89498ade31493c06cfc;hp=f5df04be4a4962f63107af1556456d9d05eeaf07;hpb=939801a8d87a56f98ffdc9bb96f1c11e299f4edf;p=ardour.git diff --git a/libs/surfaces/mackie/controls.cc b/libs/surfaces/mackie/controls.cc index f5df04be4a..1c88c2b74c 100644 --- a/libs/surfaces/mackie/controls.cc +++ b/libs/surfaces/mackie/controls.cc @@ -34,8 +34,10 @@ #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 ac) +Control::set_control (boost::shared_ptr ac) { normal_ac = ac; } void -Control::set_modified_control (boost::shared_ptr ac) +Control::set_value (float val) { - modified_ac = ac; -} - -void -Control::set_value (float val, bool modified) -{ - 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)); } } 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; +} +