2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef ardour_control_protocol_manager_h
21 #define ardour_control_protocol_manager_h
27 #include <glibmm/threads.h>
29 #include "pbd/stateful.h"
30 #include "ardour/session_handle.h"
34 class ControlProtocol;
35 class ControlProtocolDescriptor;
38 class LIBARDOUR_API ControlProtocolInfo {
40 ControlProtocolDescriptor* descriptor;
41 ControlProtocol* protocol;
46 bool supports_feedback;
49 ControlProtocolInfo() : descriptor (0), protocol (0), requested(false),
50 mandatory(false), supports_feedback(false), state (0)
52 ~ControlProtocolInfo();
56 class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr
59 ~ControlProtocolManager ();
61 static ControlProtocolManager& instance();
63 void set_session (Session*);
64 void discover_control_protocols ();
65 void foreach_known_protocol (boost::function<void(const ControlProtocolInfo*)>);
66 void load_mandatory_protocols ();
67 void midi_connectivity_established ();
68 void drop_protocols ();
69 void register_request_buffer_factories ();
71 int activate (ControlProtocolInfo&);
72 int deactivate (ControlProtocolInfo&);
74 std::list<ControlProtocolInfo*> control_protocol_info;
76 static const std::string state_node_name;
78 int set_state (const XMLNode&, int version);
79 XMLNode& get_state (void);
81 PBD::Signal1<void,ControlProtocolInfo*> ProtocolStatusChange;
84 ControlProtocolManager ();
85 static ControlProtocolManager* _instance;
87 Glib::Threads::Mutex protocols_lock;
88 std::list<ControlProtocol*> control_protocols;
90 void session_going_away ();
92 int control_protocol_discover (std::string path);
93 ControlProtocolDescriptor* get_descriptor (std::string path);
94 ControlProtocolInfo* cpi_by_name (std::string);
95 ControlProtocol* instantiate (ControlProtocolInfo&);
96 int teardown (ControlProtocolInfo&);
101 #endif // ardour_control_protocol_manager_h