1 /*
2  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017-2019 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __libardour_vca_manager_h__
21 #define __libardour_vca_manager_h__
22 
23 #include <string>
24 #include <list>
25 
26 #include <boost/shared_ptr.hpp>
27 
28 #include <glibmm/threads.h>
29 
30 #include "pbd/signals.h"
31 #include "pbd/statefuldestructible.h"
32 
33 #include "ardour/session_handle.h"
34 #include "ardour/types.h"
35 #include "ardour/libardour_visibility.h"
36 
37 namespace ARDOUR {
38 
39 class VCA;
40 
41 class LIBARDOUR_API VCAManager : public SessionHandleRef, public PBD::StatefulDestructible
42 {
43 public:
44 	VCAManager (ARDOUR::Session&);
45 	~VCAManager ();
46 
47 	VCAList create_vca (uint32_t how_many, std::string const & name = std::string());
48 	void remove_vca (boost::shared_ptr<VCA>);
49 
50 	boost::shared_ptr<VCA> vca_by_number(int32_t) const;
51 	boost::shared_ptr<VCA> vca_by_name (std::string const&) const;
52 
53 	VCAList vcas() const;
n_vcas()54 	VCAList::size_type n_vcas() const { return _vcas.size(); }
55 
56 	PBD::Signal1<void,VCAList&> VCAAdded;
57 	PBD::Signal0<void> VCACreated; /*<< is not emitted during set_state */
58 
59 	XMLNode& get_state();
60 	int set_state (XMLNode const&, int version);
61 
vcas_loaded()62 	bool vcas_loaded() const { return _vcas_loaded; }
63 	void clear_all_solo_state ();
64 
65 	static std::string xml_node_name;
66 
67 private:
68 	mutable Glib::Threads::Mutex lock;
69 	VCAList _vcas;
70 	bool _vcas_loaded;
71 
72 	void clear ();
73 };
74 
75 } // namespace
76 
77 #endif /* __libardour_vca_manager_h__ */
78