Ardour  9.10
control_protocol_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2007 Tim Mayberry <mojofunk@gmail.com>
4  * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
5  * Copyright (C) 2009 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2015-2016 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #pragma once
24 
25 #include <list>
26 #include <string>
27 
28 #include "pbd/rwlock.h"
29 #include "pbd/stateful.h"
30 
31 #include "control_protocol/types.h"
32 
33 #include "ardour/session_handle.h"
34 #include "ardour/types.h"
35 
36 namespace ARDOUR
37 {
38 
39 class ControlProtocol;
40 class ControlProtocolDescriptor;
41 class Session;
42 
44 {
45 public:
48  std::string name;
49  std::string path;
50  bool requested;
51  bool automatic;
53  std::string config;
54 
56  : descriptor (0)
57  , protocol (0)
58  , requested (false)
59  , automatic (false)
60  , state (0)
61  {
62  }
64 
65  bool active () const;
66 };
67 
69 {
70 public:
72 
74 
77  void foreach_known_protocol (std::function<void (const ControlProtocolInfo*)>);
79  void drop_protocols ();
81  void probe_usb_control_protocols (bool, uint16_t, uint16_t);
82 
83  const std::list<ControlProtocolInfo*>& control_protocol_infos () const
84  {
85  return _control_protocol_info;
86  }
87 
88  int activate (ControlProtocolInfo&, std::string const & config);
90 
91  static const std::string state_node_name;
92 
93  int set_state (const XMLNode&, int version);
94  XMLNode& get_state () const;
95 
97 
100 
101  void do_surface_callback (bool once_only, ARDOUR::SurfaceCallbackType type, void* arg = nullptr);
102 
103 private:
106 
108  std::list<ControlProtocol*> _control_protocols;
109  std::list<ControlProtocolInfo*> _control_protocol_info;
110 
112 
113  int control_protocol_discover (std::string path);
116  ControlProtocol* instantiate (ControlProtocolInfo&, std::string const & config);
117  int teardown (ControlProtocolInfo&, bool lock_required);
118 };
119 
120 } // namespace ARDOUR
ControlProtocolDescriptor * descriptor
int teardown(ControlProtocolInfo &, bool lock_required)
int deactivate(ControlProtocolInfo &)
void stripable_selection_changed(ARDOUR::StripableNotificationListPtr)
const std::list< ControlProtocolInfo * > & control_protocol_infos() const
ControlProtocolInfo * cpi_by_name(std::string)
ControlProtocolDescriptor * get_descriptor(std::string path)
static PBD::Signal< void(ARDOUR::StripableNotificationListPtr)> StripableSelectionChanged
static const std::string state_node_name
int control_protocol_discover(std::string path)
int set_state(const XMLNode &, int version)
static ControlProtocolManager * _instance
int activate(ControlProtocolInfo &, std::string const &config)
PBD::Signal< void(ControlProtocolInfo *)> ProtocolStatusChange
void do_surface_callback(bool once_only, ARDOUR::SurfaceCallbackType type, void *arg=nullptr)
std::list< ControlProtocol * > _control_protocols
void probe_usb_control_protocols(bool, uint16_t, uint16_t)
ControlProtocol * instantiate(ControlProtocolInfo &, std::string const &config)
std::list< ControlProtocolInfo * > _control_protocol_info
static ControlProtocolManager & instance()
void foreach_known_protocol(std::function< void(const ControlProtocolInfo *)>)
Definition: xml++.h:114
#define LIBARDOUR_API
PBD::PropertyDescriptor< bool > automatic
std::shared_ptr< StripableNotificationList > StripableNotificationListPtr