summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/control_protocol_manager.h
blob: f0b7846978a96b649b2014dfd8281bb6aa47c5e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef ardour_control_protocol_manager_h
#define ardour_control_protocol_manager_h

#include <string>
#include <list>

#include <pbd/lockmonitor.h>

namespace ARDOUR {

class ControlProtocol;
class ControlProtocolDescriptor;

struct ControlProtocolInfo {
    ControlProtocolDescriptor* descriptor;
    ControlProtocol* protocol;
    std::string name;
    std::string path;
};

class ControlProtocolManager
{
  public:
	ControlProtocolManager ();
	~ControlProtocolManager ();

	static ControlProtocolManager& instance() { return *_instance; }

	void discover_control_protocols (std::string search_path);
	void startup (Session&);

	ControlProtocol* instantiate (Session&, std::string protocol_name);
	int              teardown (std::string protocol_name);

  private:
	static ControlProtocolManager* _instance;

	PBD::Lock protocols_lock;
	std::list<ControlProtocolInfo*> control_protocol_info;
	std::list<ControlProtocol*>    control_protocols;

	int control_protocol_discover (std::string path);
	ControlProtocolDescriptor* get_descriptor (std::string path);
};

} // namespace

#endif // ardour_control_protocol_manager_h