show gain level as its adjusted from ardour GUI (not reverted back); basic support...
[ardour.git] / libs / surfaces / mackie / strip.h
1 #ifndef __ardour_mackie_control_protocol_strip_h__
2 #define __ardour_mackie_control_protocol_strip_h__
3
4 #include <string>
5 #include <iostream>
6
7 #include "pbd/property_basics.h"
8 #include "pbd/signals.h"
9
10 #include "control_protocol/types.h"
11
12 #include "control_group.h"
13 #include "types.h"
14 #include "midi_byte_array.h"
15
16 namespace ARDOUR {
17         class Route;
18 }
19
20 namespace Mackie {
21
22 class Control;
23 class Surface;
24 class Button;
25 class Pot;
26 class Fader;
27 class Meter;
28 class SurfacePort;
29
30 struct StripControlDefinition {
31     const char* name;
32     uint32_t base_id;
33     Control* (*factory)(Surface&, int index, const char* name, Group&);
34 };
35
36 struct GlobalControlDefinition {
37     const char* name;
38     uint32_t id;
39     Control* (*factory)(Surface&, int index, const char* name, Group&);
40     const char* group_name;
41 };
42
43 /**
44         This is the set of controls that make up a strip.
45 */
46 class Strip : public Group
47 {
48 public:
49         Strip (Surface&, const std::string & name, int index, StripControlDefinition* ctls);
50         ~Strip();
51
52         boost::shared_ptr<ARDOUR::Route> route() const { return _route; }
53
54         void add (Control & control);
55         int index() const { return _index; } // zero based
56         
57         void set_route (boost::shared_ptr<ARDOUR::Route>);
58
59         // call all signal handlers manually
60         void notify_all();
61
62         void handle_button (Button&, ButtonState bs);
63         void handle_fader (Fader&, float position);
64         void handle_pot (Pot&, float delta);
65
66         void periodic ();
67
68         MidiByteArray display (uint32_t line_number, const std::string&);
69         MidiByteArray blank_display (uint32_t line_number);
70         MidiByteArray zero ();
71
72         void flip_mode_changed (bool notify=false);
73
74         void lock_controls ();
75         void unlock_controls ();
76         
77         MidiByteArray gui_selection_changed (ARDOUR::RouteNotificationListPtr);
78
79 private:
80         Button*  _solo;
81         Button*  _recenable;
82         Button*  _mute;
83         Button*  _select;
84         Button*  _vselect;
85         Button*  _fader_touch;
86         Pot*     _vpot;
87         Fader*   _fader;
88         Meter*   _meter;
89         int      _index;
90         Surface* _surface;
91         bool     _controls_locked;
92
93         boost::shared_ptr<ARDOUR::Route> _route;
94         PBD::ScopedConnectionList route_connections;
95
96         float _last_gain_position_written;
97         float _last_pan_position_written;
98
99         void notify_solo_changed ();
100         void notify_mute_changed ();
101         void notify_record_enable_changed ();
102         void notify_gain_changed (bool force_update = true);
103         void notify_property_changed (const PBD::PropertyChange&);
104         void notify_panner_changed (bool force_update = true);
105         void notify_active_changed ();
106         void notify_route_deleted ();
107         
108         void update_automation ();
109         void update_meter ();
110
111         std::string static_display_string () const;
112 };
113
114 }
115
116 #endif /* __ardour_mackie_control_protocol_strip_h__ */