session export starts from session start marker; add tooltips for rude solo + auditio...
[ardour.git] / libs / ardour / ardour / control_protocol_manager.h
1 #ifndef ardour_control_protocol_manager_h
2 #define ardour_control_protocol_manager_h
3
4 #include <string>
5 #include <list>
6
7 #include <sigc++/sigc++.h>
8
9 #include <glibmm/thread.h>
10
11 #include <pbd/stateful.h> 
12
13 namespace ARDOUR {
14
15 class ControlProtocol;
16 class ControlProtocolDescriptor;
17 class Session;
18
19 struct ControlProtocolInfo {
20     ControlProtocolDescriptor* descriptor;
21     ControlProtocol* protocol;
22     std::string name;
23     std::string path;
24     bool requested;
25     bool mandatory;
26     bool supports_feedback;
27     XMLNode* state;
28
29     ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {}
30     ~ControlProtocolInfo() { if (state) { delete state; } }
31 };
32
33  class ControlProtocolManager : public sigc::trackable, public Stateful
34 {
35   public:
36         ControlProtocolManager ();
37         ~ControlProtocolManager ();
38
39         static ControlProtocolManager& instance() { return *_instance; }
40
41         void set_session (Session&);
42         void discover_control_protocols (std::string search_path);
43         void foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*>);
44         void load_mandatory_protocols ();
45
46         ControlProtocol* instantiate (ControlProtocolInfo&);
47         int              teardown (ControlProtocolInfo&);
48
49         std::list<ControlProtocolInfo*> control_protocol_info;
50
51         static const std::string state_node_name;
52
53         void set_protocol_states (const XMLNode&);
54
55         int set_state (const XMLNode&);
56         XMLNode& get_state (void);
57
58   private:
59         static ControlProtocolManager* _instance;
60
61         Session* _session;
62         Glib::Mutex protocols_lock;
63         std::list<ControlProtocol*>    control_protocols;
64
65         void drop_session ();
66
67         int control_protocol_discover (std::string path);
68         ControlProtocolDescriptor* get_descriptor (std::string path);
69         ControlProtocolInfo* cpi_by_name (std::string);
70 };
71
72 } // namespace
73
74 #endif // ardour_control_protocol_manager_h