Ardour  8.12
send.h
Go to the documentation of this file.
1 /*
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>
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_send_h__
24 #define __ardour_send_h__
25 
26 #include <string>
27 
28 #include "pbd/stateful.h"
29 
30 #include "ardour/ardour.h"
31 #include "ardour/delivery.h"
32 
33 namespace ARDOUR {
34 
35 class PeakMeter;
36 class GainControl;
37 class DelayLine;
38 
41 {
42 public:
44  virtual ~LatentSend() {}
45 
46  samplecnt_t get_delay_in () const { return _delay_in; }
47  samplecnt_t get_delay_out () const { return _delay_out; }
48 
49  /* should only be called by Route::update_signal_latency */
50  virtual void set_delay_in (samplecnt_t) = 0;
51 
52  /* should only be called by InternalReturn::set_playback_offset
53  * (via Route::update_signal_latency)
54  */
55  virtual void set_delay_out (samplecnt_t, size_t bus = 0) = 0;
56  virtual void update_delaylines (bool rt_ok) = 0;
57 
58  static PBD::Signal0<void> ChangedLatency;
59  static PBD::Signal0<void> QueueUpdate;
60 
61 protected:
64 };
65 
66 class LIBARDOUR_API Send : public Delivery, public LatentSend
67 {
68 public:
69  Send (Session&, std::shared_ptr<Pannable> pannable, std::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send, bool ignore_bitslot = false);
70  virtual ~Send ();
71 
72  bool display_to_user() const;
73  bool is_foldback () const { return _role == Foldback; }
74 
75  std::shared_ptr<PeakMeter> meter() const { return _meter; }
76 
77  bool metering() const { return _metering; }
78  void set_metering (bool yn) { _metering = yn; }
79 
80  int set_state(const XMLNode&, int version);
81 
82  PBD::Signal0<void> SelfDestruct;
83  void set_remove_on_disconnect (bool b) { _remove_on_disconnect = b; }
84  bool remove_on_disconnect () const { return _remove_on_disconnect; }
85 
86  bool has_panner () const;
87  bool panner_linked_to_route () const;
89 
90  uint32_t pans_required() const { return _configured_input.n_audio(); }
91 
92  void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
93 
96 
97  /* latency compensation */
99  void set_delay_out (samplecnt_t, size_t bus = 0);
100  samplecnt_t get_delay_in () const { return _delay_in; }
101  samplecnt_t get_delay_out () const { return _delay_out; }
103 
104  void activate ();
105  void deactivate ();
106 
107  void update_delaylines (bool rt_ok);
108 
109  bool set_name (const std::string& str);
110 
111  static std::string name_and_id_new_send (Session&, Delivery::Role r, uint32_t&, bool);
112 
113 protected:
114  XMLNode& state () const;
115 
116  bool _metering;
117  std::shared_ptr<PeakMeter> _meter;
118  std::shared_ptr<DelayLine> _send_delay;
119  std::shared_ptr<DelayLine> _thru_delay;
120 
121 private:
122  /* disallow copy construction */
123  Send (const Send&);
124 
128 
129  int set_state_2X (XMLNode const &, int);
130 
132 };
133 
134 } // namespace ARDOUR
135 
136 #endif /* __ardour_send_h__ */
static PBD::Signal0< void > ChangedLatency
Definition: send.h:58
virtual ~LatentSend()
Definition: send.h:44
samplecnt_t get_delay_out() const
Definition: send.h:47
virtual void update_delaylines(bool rt_ok)=0
virtual void set_delay_in(samplecnt_t)=0
samplecnt_t _delay_in
Definition: send.h:62
static PBD::Signal0< void > QueueUpdate
Definition: send.h:59
samplecnt_t get_delay_in() const
Definition: send.h:46
virtual void set_delay_out(samplecnt_t, size_t bus=0)=0
samplecnt_t _delay_out
Definition: send.h:63
void snd_output_changed(IOChange, void *)
void panshell_changed()
void set_metering(bool yn)
Definition: send.h:78
void set_remove_on_disconnect(bool b)
Definition: send.h:83
Send(Session &, std::shared_ptr< Pannable > pannable, std::shared_ptr< MuteMaster >, Delivery::Role r=Delivery::Send, bool ignore_bitslot=false)
void set_delay_in(samplecnt_t)
bool display_to_user() const
std::shared_ptr< PeakMeter > meter() const
Definition: send.h:75
void set_delay_out(samplecnt_t, size_t bus=0)
bool _metering
Definition: send.h:116
void activate()
std::shared_ptr< DelayLine > _send_delay
Definition: send.h:118
std::shared_ptr< DelayLine > _thru_delay
Definition: send.h:119
PBD::Signal0< void > SelfDestruct
Definition: send.h:82
std::shared_ptr< PeakMeter > _meter
Definition: send.h:117
bool can_support_io_configuration(const ChanCount &in, ChanCount &out)
Send(const Send &)
uint32_t pans_required() const
Definition: send.h:90
int set_state(const XMLNode &, int version)
bool set_name(const std::string &str)
bool remove_on_disconnect() const
Definition: send.h:84
samplecnt_t get_delay_in() const
Definition: send.h:100
void deactivate()
bool metering() const
Definition: send.h:77
void set_panner_linked_to_route(bool)
static std::string name_and_id_new_send(Session &, Delivery::Role r, uint32_t &, bool)
bool is_foldback() const
Definition: send.h:73
void update_delaylines(bool rt_ok)
bool configure_io(ChanCount in, ChanCount out)
void pannable_changed()
void run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
samplecnt_t get_delay_out() const
Definition: send.h:101
bool _remove_on_disconnect
Definition: send.h:131
samplecnt_t signal_latency() const
bool panner_linked_to_route() const
int set_state_2X(XMLNode const &, int)
XMLNode & state() const
virtual ~Send()
bool has_panner() const
Definition: xml++.h:114
#define LIBARDOUR_API
uint32_t pframes_t
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t