2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Lesser
6 General Public License as published by the Free Software
7 Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef ardour_control_protocols_h
22 #define ardour_control_protocols_h
27 #include <boost/shared_ptr.hpp>
28 #include <sigc++/sigc++.h>
29 #include <pbd/stateful.h>
30 #include <control_protocol/basic_ui.h>
37 class ControlProtocol : public sigc::trackable, public Stateful, public BasicUI {
39 ControlProtocol (Session&, std::string name);
40 virtual ~ControlProtocol();
42 std::string name() const { return _name; }
44 virtual int set_active (bool yn) = 0;
45 bool get_active() const { return _active; }
47 virtual int set_feedback (bool yn) { return 0; }
48 virtual bool get_feedback () const { return false; }
50 sigc::signal<void> ActiveChanged;
52 /* signals that a control protocol can emit and other (presumably graphical)
53 user interfaces can respond to
56 static sigc::signal<void> ZoomToSession;
57 static sigc::signal<void> ZoomIn;
58 static sigc::signal<void> ZoomOut;
59 static sigc::signal<void> Enter;
60 static sigc::signal<void,float> ScrollTimeline;
62 /* the model here is as follows:
64 we imagine most control surfaces being able to control
65 from 1 to N tracks at a time, with a session that may
66 contain 1 to M tracks, where M may be smaller, larger or
69 the control surface has a fixed set of physical controllers
70 which can potentially be mapped onto different tracks/busses
73 therefore, the control protocol object maintains
74 a table that reflects the current mapping between
75 the controls and route object.
78 void set_route_table_size (uint32_t size);
79 void set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route>);
80 bool set_route_table (uint32_t table_index, uint32_t remote_control_id);
82 void route_set_rec_enable (uint32_t table_index, bool yn);
83 bool route_get_rec_enable (uint32_t table_index);
85 float route_get_gain (uint32_t table_index);
86 void route_set_gain (uint32_t table_index, float);
87 float route_get_effective_gain (uint32_t table_index);
89 float route_get_peak_input_power (uint32_t table_index, uint32_t which_input);
91 bool route_get_muted (uint32_t table_index);
92 void route_set_muted (uint32_t table_index, bool);
94 bool route_get_soloed (uint32_t table_index);
95 void route_set_soloed (uint32_t table_index, bool);
97 std::string route_get_name (uint32_t table_index);
100 std::vector<boost::shared_ptr<ARDOUR::Route> > route_table;
104 void next_track (uint32_t initial_id);
105 void prev_track (uint32_t initial_id);
109 struct ControlProtocolDescriptor {
110 const char* name; /* descriptive */
111 const char* id; /* unique and version-specific */
112 void* ptr; /* protocol can store a value here */
113 void* module; /* not for public access */
114 int mandatory; /* if non-zero, always load and do not make optional */
115 bool supports_feedback; /* if true, protocol has toggleable feedback mechanism */
116 bool (*probe)(ControlProtocolDescriptor*);
117 ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
118 void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
125 #endif // ardour_control_protocols_h