2 * Copyright (C) 2006-2009 David Robillard <d@drobilla.net>
3 * Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
5 * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
6 * Copyright (C) 2018 Len Ovens <len@ovenwerks.net>
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.
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.
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.
23 #ifndef __ardour_send_h__
24 #define __ardour_send_h__
28 #include "pbd/stateful.h"
30 #include "ardour/ardour.h"
31 #include "ardour/delivery.h"
40 /** Internal Abstraction for Sends (and MixbusSends) */
41 class LIBARDOUR_API LatentSend
45 virtual ~LatentSend() {}
47 samplecnt_t get_delay_in () const { return _delay_in; }
48 samplecnt_t get_delay_out () const { return _delay_out; }
50 /* should only be called by Route::update_signal_latency */
51 virtual void set_delay_in (samplecnt_t) = 0;
53 /* should only be called by InternalReturn::set_playback_offset
54 * (via Route::update_signal_latency)
56 virtual void set_delay_out (samplecnt_t, size_t bus = 0) = 0;
58 static PBD::Signal0<void> ChangedLatency;
61 samplecnt_t _delay_in;
62 samplecnt_t _delay_out;
65 class LIBARDOUR_API Send : public Delivery, public LatentSend
68 Send (Session&, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send, bool ignore_bitslot = false);
71 uint32_t bit_slot() const { return _bitslot; }
73 bool display_to_user() const;
74 bool is_foldback () const { return _role == Foldback; }
76 boost::shared_ptr<Amp> amp() const { return _amp; }
77 boost::shared_ptr<PeakMeter> meter() const { return _meter; }
78 boost::shared_ptr<GainControl> gain_control() const { return _gain_control; }
80 bool metering() const { return _metering; }
81 void set_metering (bool yn) { _metering = yn; }
83 int set_state(const XMLNode&, int version);
85 PBD::Signal0<void> SelfDestruct;
86 void set_remove_on_disconnect (bool b) { _remove_on_disconnect = b; }
87 bool remove_on_disconnect () const { return _remove_on_disconnect; }
89 uint32_t pans_required() const { return _configured_input.n_audio(); }
91 void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
93 bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
94 bool configure_io (ChanCount in, ChanCount out);
96 /* latency compensation */
97 void set_delay_in (samplecnt_t);
98 void set_delay_out (samplecnt_t, size_t bus = 0);
99 samplecnt_t get_delay_in () const { return _delay_in; }
100 samplecnt_t get_delay_out () const { return _delay_out; }
101 samplecnt_t signal_latency () const;
106 bool set_name (const std::string& str);
108 static std::string name_and_id_new_send (Session&, Delivery::Role r, uint32_t&, bool);
114 boost::shared_ptr<GainControl> _gain_control;
115 boost::shared_ptr<Amp> _amp;
116 boost::shared_ptr<PeakMeter> _meter;
117 boost::shared_ptr<DelayLine> _send_delay;
118 boost::shared_ptr<DelayLine> _thru_delay;
121 /* disallow copy construction */
124 void panshell_changed ();
125 void snd_output_changed (IOChange, void*);
127 void update_delaylines ();
129 int set_state_2X (XMLNode const &, int);
132 bool _remove_on_disconnect;
135 } // namespace ARDOUR
137 #endif /* __ardour_send_h__ */