#include <iomanip>
#include <sstream>
+#include "ardour/automation_control.h"
+
#include "controls.h"
#include "types.h"
-#include "mackie_midi_builder.h"
#include "surface.h"
#include "control_group.h"
-
#include "button.h"
#include "led.h"
-#include "ledring.h"
#include "pot.h"
#include "fader.h"
#include "jog.h"
#include "meter.h"
-using namespace Mackie;
using namespace std;
+using namespace ArdourSurface;
+using namespace Mackie;
+
+using ARDOUR::AutomationControl;
void Group::add (Control& control)
{
_in_use = in_use;
}
-ostream & Mackie::operator << (ostream & os, const Mackie::Control & control)
+void
+Control::set_control (boost::shared_ptr<AutomationControl> ac)
+{
+ normal_ac = ac;
+}
+
+void
+Control::set_value (float val)
+{
+ if (normal_ac) {
+ normal_ac->set_value (normal_ac->interface_to_internal (val));
+ }
+}
+
+float
+Control::get_value ()
+{
+ if (!normal_ac) {
+ return 0.0f;
+ }
+ return normal_ac->internal_to_interface (normal_ac->get_value());
+}
+
+void
+Control::start_touch (double when)
+{
+ if (normal_ac) {
+ return normal_ac->start_touch (when);
+ }
+}
+
+void
+Control::stop_touch (bool mark, double when)
+{
+ 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(4) << setfill('0') << hex << control.id() << setfill(' ');
- os << ", ";
- os << "type: " << "0x" << setw(2) << setfill('0') << hex << control.type() << setfill(' ');
- os << ", ";
- os << "raw_id: " << "0x" << setw(2) << setfill('0') << hex << control.raw_id() << setfill(' ');
+ os << "id: " << "0x" << setw(2) << setfill('0') << hex << control.id() << setfill(' ');
os << ", ";
os << "group: " << control.group().name();
os << " }";
-
- return os;
-}
-
-Control*
-Pot::factory (Surface& surface, int id, const char* name, Group& group)
-{
- Pot* p = new Pot (id, name, group);
- surface.pots[id] = p;
- surface.controls.push_back (p);
- group.add (*p);
- return p;
-}
-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;
+ return os;
}