summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/port_manager.h
blob: 8a363899ea4972ea3c478a8e3b86a95e0c3f6b24 (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
49
50
namespace ARDOUR

class PortManager 
{
  public:
	PortManager() {}
	virtual ~PortManager() {}

	/* Port registration */
	
	virtual boost::shared_ptr<Port> register_input_port (DataType, const std::string& portname) = 0;
	virtual boost::shared_ptr<Port> register_output_port (DataType, const std::string& portname) = 0;
	virtual int unregister_port (boost::shared_ptr<Port>) = 0;
	
	/* Port connectivity */
	
	virtual int connect (const std::string& source, const std::string& destination) = 0;
	virtual int disconnect (const std::string& source, const std::string& destination) = 0;
	virtual int disconnect (boost::shared_ptr<Port>) = 0;
	
	/* other Port management */
	
	virtual bool port_is_physical (const std::string&) const = 0;
	virtual void get_physical_outputs (DataType type, std::vector<std::string>&) = 0;
	virtual void get_physical_inputs (DataType type, std::vector<std::string>&) = 0;
	virtual boost::shared_ptr<Port> get_port_by_name (const std::string &) = 0;
	virtual void port_renamed (const std::string&, const std::string&) = 0;
	virtual ChanCount n_physical_outputs () const = 0;
	virtual ChanCount n_physical_inputs () const = 0;
	virtual const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags) = 0;

	/* per-Port monitoring */
	
	virtual bool can_request_input_monitoring () const = 0;
	virtual void request_input_monitoring (const std::string&, bool) const = 0;

	class PortRegistrationFailure : public std::exception {
	public:
		PortRegistrationFailure (std::string const & why = "")
			: reason (why) {}

		~PortRegistrationFailure () throw () {}

		virtual const char *what() const throw () { return reason.c_str(); }

	private:
		std::string reason;
	};

};