1 #ifndef __ardour_mackie_control_protocol_strip_h__
2 #define __ardour_mackie_control_protocol_strip_h__
7 #include "evoral/Parameter.hpp"
9 #include "pbd/property_basics.h"
10 #include "pbd/ringbuffer.h"
11 #include "pbd/signals.h"
13 #include "ardour/types.h"
14 #include "control_protocol/types.h"
16 #include "control_group.h"
18 #include "mackie_control_protocol.h"
19 #include "midi_byte_array.h"
20 #include "device_info.h"
28 namespace ArdourSurface {
40 struct GlobalControlDefinition {
43 Control* (*factory)(Surface&, int index, const char* name, Group&);
44 const char* group_name;
48 This is the set of controls that make up a strip.
50 class Strip : public Group
53 Strip (Surface&, const std::string & name, int index, const std::map<Button::ID,StripButtonInfo>&);
56 boost::shared_ptr<ARDOUR::Route> route() const { return _route; }
58 void add (Control & control);
59 int index() const { return _index; } // zero based
61 void set_route (boost::shared_ptr<ARDOUR::Route>, bool with_messages = true);
63 // call all signal handlers manually
66 void handle_button (Button&, ButtonState bs);
67 void handle_fader (Fader&, float position);
68 void handle_fader_touch (Fader&, bool touch_on);
69 void handle_pot (Pot&, float delta);
71 void periodic (ARDOUR::microseconds_t now_usecs);
72 void redisplay (ARDOUR::microseconds_t now_usecs);
74 MidiByteArray display (uint32_t line_number, const std::string&);
75 MidiByteArray blank_display (uint32_t line_number);
79 void potmode_changed (bool notify=false);
81 void lock_controls ();
82 void unlock_controls ();
83 bool locked() const { return _controls_locked; }
85 void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
87 void notify_metering_state_changed();
89 void block_screen_display_for (uint32_t msecs);
90 void block_vpot_mode_display_for (uint32_t msecs);
92 void use_subview (MackieControlProtocol::SubViewMode, boost::shared_ptr<ARDOUR::Route>);
100 Button* _fader_touch;
106 bool _controls_locked;
107 bool _transport_is_rolling;
108 bool _metering_active;
109 uint64_t _block_vpot_mode_redisplay_until;
110 uint64_t _block_screen_redisplay_until;
111 boost::shared_ptr<ARDOUR::Route> _route;
112 boost::shared_ptr<ARDOUR::Route> _subview_route;
113 PBD::ScopedConnectionList route_connections;
114 PBD::ScopedConnectionList subview_connections;
115 PBD::ScopedConnectionList send_connections;
117 ARDOUR::AutomationType _pan_mode;
118 ARDOUR::AutomationType _trim_mode;
119 ARDOUR::AutomationType vpot_parameter;
121 float _last_gain_position_written;
122 float _last_pan_azi_position_written;
123 float _last_pan_width_position_written;
124 float _last_trim_position_written;
125 uint32_t _current_send;
127 void notify_solo_changed ();
128 void notify_mute_changed ();
129 void notify_record_enable_changed ();
130 void notify_gain_changed (bool force_update = true);
131 void notify_property_changed (const PBD::PropertyChange&);
132 void notify_panner_azi_changed (bool force_update = true);
133 void notify_panner_width_changed (bool force_update = true);
134 void notify_active_changed ();
135 void notify_route_deleted ();
136 void notify_trim_changed (bool force_update = true);
137 void notify_phase_changed (bool force_update = true);
138 void notify_processor_changed (bool force_update = true);
139 void update_automation ();
140 void update_meter ();
141 std::string vpot_mode_string ();
143 boost::shared_ptr<ARDOUR::AutomationControl> mb_pan_controllable;
145 void return_to_vpot_mode_display ();
147 struct RedisplayRequest {
148 ARDOUR::AutomationType type;
152 RingBuffer<RedisplayRequest> redisplay_requests;
154 void do_parameter_display (ARDOUR::AutomationType, float val);
155 void queue_parameter_display (ARDOUR::AutomationType, float val);
157 void select_event (Button&, ButtonState);
158 void vselect_event (Button&, ButtonState);
159 void fader_touch_event (Button&, ButtonState);
161 std::vector<Evoral::Parameter> possible_pot_parameters;
162 std::vector<Evoral::Parameter> possible_trim_parameters;
163 void next_pot_mode ();
164 void set_vpot_parameter (Evoral::Parameter, boost::shared_ptr<ARDOUR::Route> target_route = boost::shared_ptr<ARDOUR::Route>());
165 void show_route_name ();
167 void reset_saved_values ();
169 bool is_midi_track () const;
171 typedef std::map<Evoral::Parameter,Control*> ControlParameterMap;
172 ControlParameterMap control_by_parameter;
174 void hookup_eq (ARDOUR::AutomationType, uint32_t);
175 void notify_eq_change (ARDOUR::AutomationType, uint32_t, bool force);
181 #endif /* __ardour_mackie_control_protocol_strip_h__ */