1 /*
2  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2013-2017 Robin Gareus <robin@gareus.org>
6  * Copyright (C) 2018 Len Ovens <len@ovenwerks.net>
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 #ifndef __ardour_internal_send_h__
24 #define __ardour_internal_send_h__
25 
26 #include "ardour/ardour.h"
27 #include "ardour/send.h"
28 
29 namespace ARDOUR {
30 
31 class LIBARDOUR_API InternalSend : public Send
32 {
33 public:
34 	InternalSend (Session&, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_from, boost::shared_ptr<Route> send_to, Delivery::Role role = Delivery::Aux, bool ignore_bitslot = false);
35 	virtual ~InternalSend ();
36 
37 	std::string display_name() const;
38 	bool set_name (const std::string&);
39 	bool visible() const;
40 
41 	int set_state(const XMLNode& node, int version);
42 
43 	void cycle_start (pframes_t);
44 	void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
45 	bool feeds (boost::shared_ptr<Route> other) const;
46 	bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
47 	bool configure_io (ChanCount in, ChanCount out);
48 	int  set_block_size (pframes_t);
49 
source_route()50 	boost::shared_ptr<Route> source_route() const { return _send_from; }
target_route()51 	boost::shared_ptr<Route> target_route() const { return _send_to; }
target_id()52 	const PBD::ID& target_id() const { return _send_to_id; }
53 
get_buffers()54 	BufferSet const & get_buffers () const {
55 		return mixbufs;
56 	}
57 
allow_feedback()58 	bool allow_feedback () const { return _allow_feedback;}
59 	void set_allow_feedback (bool yn);
60 
61 	void set_can_pan (bool yn);
62 	uint32_t pan_outs () const;
63 
64 	static PBD::Signal1<void, pframes_t> CycleStart;
65 
66 protected:
67 	XMLNode& state();
68 
69 private:
70 	BufferSet mixbufs;
71 	boost::shared_ptr<Route> _send_from;
72 	boost::shared_ptr<Route> _send_to;
73 	bool _allow_feedback;
74 	PBD::ID _send_to_id;
75 	PBD::ScopedConnection connect_c;
76 	PBD::ScopedConnection source_connection;
77 	PBD::ScopedConnectionList target_connections;
78 
79 	void send_from_going_away ();
80 	void send_to_going_away ();
81 	void send_to_property_changed (const PBD::PropertyChange&);
82 	int  connect_when_legal ();
83 	void init_gain ();
84 	int  use_target (boost::shared_ptr<Route>, bool update_name = true);
85 	void target_io_changed ();
86 
87 	void propagate_solo ();
88 };
89 
90 } // namespace ARDOUR
91 
92 #endif /* __ardour_send_h__ */
93