1 #ifndef ardour_control_protocol_manager_h
2 #define ardour_control_protocol_manager_h
7 #include <sigc++/sigc++.h>
9 #include <glibmm/thread.h>
11 #include <pbd/stateful.h>
15 class ControlProtocol;
16 class ControlProtocolDescriptor;
19 struct ControlProtocolInfo {
20 ControlProtocolDescriptor* descriptor;
21 ControlProtocol* protocol;
26 bool supports_feedback;
29 ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {}
30 ~ControlProtocolInfo() { if (state) { delete state; } }
33 class ControlProtocolManager : public sigc::trackable, public Stateful
36 ControlProtocolManager ();
37 ~ControlProtocolManager ();
39 static ControlProtocolManager& instance() { return *_instance; }
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 ();
46 ControlProtocol* instantiate (ControlProtocolInfo&);
47 int teardown (ControlProtocolInfo&);
49 std::list<ControlProtocolInfo*> control_protocol_info;
51 static const std::string state_node_name;
53 void set_protocol_states (const XMLNode&);
55 int set_state (const XMLNode&);
56 XMLNode& get_state (void);
59 static ControlProtocolManager* _instance;
62 Glib::Mutex protocols_lock;
63 std::list<ControlProtocol*> control_protocols;
67 int control_protocol_discover (std::string path);
68 ControlProtocolDescriptor* get_descriptor (std::string path);
69 ControlProtocolInfo* cpi_by_name (std::string);
74 #endif // ardour_control_protocol_manager_h