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