Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
23 
24 #include <vector>
25 #include <string>
26 #include <exception>
27 
28 #include "ardour/ardour.h"
29 #include "ardour/io_processor.h"
30 #include "ardour/delivery.h"
32 #include "ardour/meter.h"
33 #include "ardour/types.h"
34 
35 class XMLNode;
36 class MTDM;
37 
38 namespace ARDOUR {
39 
40 class Amp;
41 class Session;
42 class IO;
43 class Delivery;
44 class PeakMeter;
45 class MuteMaster;
46 class Pannable;
47 
51 {
52 public:
53  PortInsert (Session&, std::shared_ptr<Pannable>, std::shared_ptr<MuteMaster> mm);
55 
56  int set_state (const XMLNode&, int version);
57 
58  void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
59 
60  void flush_buffers (samplecnt_t nframes);
61 
63 
64  bool set_name (const std::string& name);
65 
68 
69  void activate ();
70  void deactivate ();
71 
72  void set_pre_fader (bool);
73 
76 
77  MTDM* mtdm () const { return _mtdm; }
79 
81  return _measured_latency;
82  }
83 
84  static std::string name_and_id_new_insert (Session&, uint32_t&);
85 
86  std::shared_ptr<AutomationControl> send_polarity_control () const {
87  return _out->polarity_control ();
88  }
89 
90  std::shared_ptr<GainControl> send_gain_control () const {
91  return _out->gain_control ();
92  }
93 
94  std::shared_ptr<Amp> send_amp() const {
95  return _out->amp ();
96  }
97 
98  std::shared_ptr<Amp> return_amp() const {
99  return _amp;
100  }
101 
102  std::shared_ptr<GainControl> return_gain_control () const {
103  return _gain_control;
104  }
105 
106  std::shared_ptr<PeakMeter> send_meter() const {
107  return _send_meter;
108  }
109 
110  std::shared_ptr<PeakMeter> return_meter() const {
111  return _return_meter;
112  }
113 
114  bool metering() const {
115  return _metering;
116  }
117 
118  void set_metering (bool yn) {
119  _metering = yn;
120  }
121 
122 protected:
123  XMLNode& state () const;
124 private:
125  /* disallow copy construction */
127 
128  void io_changed (IOChange change, void*);
130 
131  std::shared_ptr<Delivery> _out;
132  std::shared_ptr<Amp> _amp;
133  std::shared_ptr<GainControl> _gain_control;
134  std::shared_ptr<PeakMeter> _send_meter;
135  std::shared_ptr<PeakMeter> _return_meter;
136  bool _metering;
137  uint32_t _io_latency;
138  uint32_t _signal_latency;
139 
144 };
145 
146 } // namespace ARDOUR
147 
std::shared_ptr< GainControl > _gain_control
Definition: port_insert.h:133
std::shared_ptr< Delivery > _out
Definition: port_insert.h:131
samplecnt_t _latency_flush_samples
Definition: port_insert.h:142
bool metering() const
Definition: port_insert.h:114
std::shared_ptr< Amp > _amp
Definition: port_insert.h:132
void flush_buffers(samplecnt_t nframes)
std::shared_ptr< PeakMeter > _send_meter
Definition: port_insert.h:134
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:143
uint32_t _signal_latency
Definition: port_insert.h:138
std::shared_ptr< GainControl > send_gain_control() const
Definition: port_insert.h:90
XMLNode & state() const
bool configure_io(ChanCount in, ChanCount out)
std::shared_ptr< PeakMeter > _return_meter
Definition: port_insert.h:135
std::shared_ptr< Amp > return_amp() const
Definition: port_insert.h:98
uint32_t _io_latency
Definition: port_insert.h:137
std::shared_ptr< GainControl > return_gain_control() const
Definition: port_insert.h:102
PortInsert(const PortInsert &)
void set_metering(bool yn)
Definition: port_insert.h:118
std::shared_ptr< AutomationControl > send_polarity_control() const
Definition: port_insert.h:86
int set_state(const XMLNode &, int version)
std::shared_ptr< PeakMeter > return_meter() const
Definition: port_insert.h:110
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:106
samplecnt_t measured_latency() const
Definition: port_insert.h:80
MTDM * mtdm() const
Definition: port_insert.h:77
PortInsert(Session &, std::shared_ptr< Pannable >, std::shared_ptr< MuteMaster > mm)
std::shared_ptr< Amp > send_amp() const
Definition: port_insert.h:94
Definition: mtdm.h:28
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