#include <string>
#include <stdint.h>
+#include <boost/smart_ptr.hpp>
+
+#include "pbd/controllable.h"
#include "pbd/signals.h"
#include "mackie_control_exception.h"
+#include "midi_byte_array.h"
+
+namespace ARDOUR {
+ class AutomationControl;
+}
+
+namespace ArdourSurface {
-namespace Mackie
-{
+namespace Mackie {
class Strip;
class Group;
-class Led;
class Surface;
-class Control
-{
+class Control {
public:
- enum type_t {
- type_led,
- type_led_ring,
- type_fader = 0xe0,
- type_button = 0x90,
- type_pot = 0xb0,
- type_meter = 0xd0
- };
-
- enum base_id_t {
- fader_base_id = 0x0,
- pot_base_id = 0x10,
- jog_base_id = 0x3c,
- fader_touch_button_base_id = 0x68,
- vselect_button_base_id = 0x20,
- select_button_base_id = 0x18,
- mute_button_base_id = 0x10,
- solo_button_base_id = 0x08,
- recenable_button_base_id = 0x0,
- meter_base_id = 0xd0,
- };
-
- Control (int id, int ordinal, std::string name, Group& group);
+ Control (int id, std::string name, Group& group);
virtual ~Control() {}
-
- virtual const Led & led() const { throw MackieControlException ("no led available"); }
-
- /// type() << 8 + midi id of the control. This
- /// provides a unique id for any control on the surface.
- int id() const { return (type() << 8) + _id; }
-
- /// 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; }
-
- /// The 1-based number of the control
- int ordinal() const { return _ordinal; }
-
+
+ int id() const { return _id; }
const std::string & name() const { return _name; }
- const Group & group() const { return _group; }
- virtual bool accepts_feedback() const { return true; }
-
- virtual type_t type() const = 0;
-
- /// Return true if this control is the one and only Jog Wheel
- virtual bool is_jog() const { return false; }
+ Group & group() const { return _group; }
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;
+
/** If we are doing an in_use timeout for a fader without touch, this
* is its touch button control; otherwise 0.
*/
Control* in_use_touch_control;
-private:
- int _id;
- int _ordinal;
+ 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, PBD::Controllable::GroupControlDisposition gcd = PBD::Controllable::UseGroup);
+
+ 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__ */