Ardour  8.12
port_insert.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
5  * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef __ardour_port_insert_h__
23 #define __ardour_port_insert_h__
24 
25 #include <vector>
26 #include <string>
27 #include <exception>
28 
29 #include "ardour/ardour.h"
30 #include "ardour/io_processor.h"
31 #include "ardour/delivery.h"
33 #include "ardour/meter.h"
34 #include "ardour/types.h"
35 
36 class XMLNode;
37 class MTDM;
38 
39 namespace ARDOUR {
40 
41 class Amp;
42 class Session;
43 class IO;
44 class Delivery;
45 class PeakMeter;
46 class MuteMaster;
47 class Pannable;
48 
52 {
53 public:
54  PortInsert (Session&, std::shared_ptr<Pannable>, std::shared_ptr<MuteMaster> mm);
56 
57  int set_state (const XMLNode&, int version);
58 
59  void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
60 
61  void flush_buffers (samplecnt_t nframes);
62 
64 
65  bool set_name (const std::string& name);
66 
69 
70  void activate ();
71  void deactivate ();
72 
73  void set_pre_fader (bool);
74 
77 
78  MTDM* mtdm () const { return _mtdm; }
80 
82  return _measured_latency;
83  }
84 
85  static std::string name_and_id_new_insert (Session&, uint32_t&);
86 
87  std::shared_ptr<AutomationControl> send_polarity_control () const {
88  return _out->polarity_control ();
89  }
90 
91  std::shared_ptr<GainControl> send_gain_control () const {
92  return _out->gain_control ();
93  }
94 
95  std::shared_ptr<Amp> send_amp() const {
96  return _out->amp ();
97  }
98 
99  std::shared_ptr<Amp> return_amp() const {
100  return _amp;
101  }
102 
103  std::shared_ptr<GainControl> return_gain_control () const {
104  return _gain_control;
105  }
106 
107  std::shared_ptr<PeakMeter> send_meter() const {
108  return _send_meter;
109  }
110 
111  std::shared_ptr<PeakMeter> return_meter() const {
112  return _return_meter;
113  }
114 
115  bool metering() const {
116  return _metering;
117  }
118 
119  void set_metering (bool yn) {
120  _metering = yn;
121  }
122 
123 protected:
124  XMLNode& state () const;
125 private:
126  /* disallow copy construction */
128 
129  void io_changed (IOChange change, void*);
131 
132  std::shared_ptr<Delivery> _out;
133  std::shared_ptr<Amp> _amp;
134  std::shared_ptr<GainControl> _gain_control;
135  std::shared_ptr<PeakMeter> _send_meter;
136  std::shared_ptr<PeakMeter> _return_meter;
137  bool _metering;
138  uint32_t _io_latency;
139  uint32_t _signal_latency;
140 
145 };
146 
147 } // namespace ARDOUR
148 
149 #endif /* __ardour_port_insert_h__ */
std::shared_ptr< GainControl > _gain_control
Definition: port_insert.h:134
std::shared_ptr< Delivery > _out
Definition: port_insert.h:132
samplecnt_t _latency_flush_samples
Definition: port_insert.h:143
bool metering() const
Definition: port_insert.h:115
std::shared_ptr< Amp > _amp
Definition: port_insert.h:133
void flush_buffers(samplecnt_t nframes)
std::shared_ptr< PeakMeter > _send_meter
Definition: port_insert.h:135
bool can_support_io_configuration(const ChanCount &in, ChanCount &out)
void io_changed(IOChange change, void *)
void start_latency_detection()
static std::string name_and_id_new_insert(Session &, uint32_t &)
samplecnt_t _measured_latency
Definition: port_insert.h:144
uint32_t _signal_latency
Definition: port_insert.h:139
std::shared_ptr< GainControl > send_gain_control() const
Definition: port_insert.h:91
XMLNode & state() const
bool configure_io(ChanCount in, ChanCount out)
std::shared_ptr< PeakMeter > _return_meter
Definition: port_insert.h:136
std::shared_ptr< Amp > return_amp() const
Definition: port_insert.h:99
uint32_t _io_latency
Definition: port_insert.h:138
std::shared_ptr< GainControl > return_gain_control() const
Definition: port_insert.h:103
PortInsert(const PortInsert &)
void set_metering(bool yn)
Definition: port_insert.h:119
std::shared_ptr< AutomationControl > send_polarity_control() const
Definition: port_insert.h:87
int set_state(const XMLNode &, int version)
std::shared_ptr< PeakMeter > return_meter() const
Definition: port_insert.h:111
samplecnt_t signal_latency() const
void stop_latency_detection()
void set_measured_latency(samplecnt_t)
void run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
void set_pre_fader(bool)
bool set_name(const std::string &name)
std::shared_ptr< PeakMeter > send_meter() const
Definition: port_insert.h:107
samplecnt_t measured_latency() const
Definition: port_insert.h:81
MTDM * mtdm() const
Definition: port_insert.h:78
PortInsert(Session &, std::shared_ptr< Pannable >, std::shared_ptr< MuteMaster > mm)
std::shared_ptr< Amp > send_amp() const
Definition: port_insert.h:95
Definition: mtdm.h:29
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
uint32_t pframes_t
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t