Don't handle possible phase change if no audio channels in mackie control
[ardour.git] / libs / surfaces / mackie / controls.h
index e3fe7ca131a7ae4fdd323a6f1e35eb91d7426e87..38eb30fb65d7a1f7598876a146ea3e7e10665e32 100644 (file)
 #include <string>
 #include <stdint.h>
 
+#include <boost/smart_ptr.hpp>
+
 #include "pbd/signals.h"
 
 #include "mackie_control_exception.h"
 #include "midi_byte_array.h"
 
-namespace Mackie
-{
+namespace ARDOUR {
+       class AutomationControl;
+}
+
+namespace ArdourSurface {
+
+namespace Mackie {
 
 class Strip;
 class Group;
 class Surface;
 
-class Control
-{
+class Control {
 public:
        Control (int id, std::string name, Group& group);
        virtual ~Control() {}
-       
-       /// the value of the second bytes of the message. It's
-       /// the id of the control, but only guaranteed to be
-       /// unique within the control type.
-       int raw_id() const { return _id; }
 
+       int id() const { return _id; }
        const std::string & name() const  { return _name; }
        Group & group() const { return _group; }
 
-       virtual bool accepts_feedback() const  { return true; }
-       
        bool in_use () const;
        void set_in_use (bool);
-       
-       /// Keep track of the timeout so it can be updated with more incoming events
+
+       // Keep track of the timeout so it can be updated with more incoming events
        sigc::connection in_use_connection;
 
        virtual MidiByteArray zero() = 0;
@@ -66,15 +66,28 @@ public:
         */
        Control* in_use_touch_control;
 
-private:
-       int _id;
+       boost::shared_ptr<ARDOUR::AutomationControl> control () const { return normal_ac; }
+       virtual void set_control (boost::shared_ptr<ARDOUR::AutomationControl>);
+
+       float get_value ();
+       void set_value (float val);
+
+       virtual void start_touch (double when);
+       virtual void stop_touch (bool mark, double when);
+
+  protected:
+       boost::shared_ptr<ARDOUR::AutomationControl> normal_ac;
+
+  private:
+       int _id; /* possibly device-dependent ID */
        std::string _name;
        Group& _group;
        bool _in_use;
 };
 
-std::ostream & operator <<  (std::ostream & os, const Control & control);
-
 }
+}
+
+std::ostream & operator <<  (std::ostream & os, const ArdourSurface::Mackie::Control & control);
 
 #endif /* __mackie_controls_h__ */