Ardour  8.12
delivery.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
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_delivery_h__
24 #define __ardour_delivery_h__
25 
26 #include <string>
27 
29 #include "ardour/types.h"
30 #include "ardour/chan_count.h"
31 #include "ardour/io_processor.h"
32 #include "ardour/gain_control.h"
33 
34 namespace ARDOUR {
35 
36 class Amp;
37 class BufferSet;
38 class IO;
39 class MuteMaster;
40 class PannerShell;
41 class Panner;
42 class Pannable;
43 
45 {
46 public:
47  enum Role {
48  /* main outputs - delivers out-of-place to port buffers, and cannot be removed */
49  Main = 0x1,
50  /* send - delivers to port buffers, leaves input buffers untouched */
51  Send = 0x2,
52  /* insert - delivers to port buffers and receives in-place from port buffers */
53  Insert = 0x4,
54  /* listen - internal send used only to deliver to control/monitor bus */
55  Listen = 0x8,
56  /* aux - internal send used to deliver to any bus, by user request */
57  Aux = 0x10,
58  /* foldback - internal send used only to deliver to a personal monitor bus */
59  Foldback = 0x20,
60  /* direct outs - used only with LiveTrax, delivers to master bus */
61  DirectOuts = 0x40
62  };
63 
64  static bool role_from_xml (const XMLNode&, Role&);
65 
66  static bool role_requires_output_ports (Role r) { return r == Main || r == Send || r == Insert || r == DirectOuts; }
67 
68  bool does_routing() const { return true; }
69 
70  /* Delivery to an existing output */
71 
72  Delivery (Session& s, std::shared_ptr<IO> io, std::shared_ptr<Pannable>, std::shared_ptr<MuteMaster> mm, const std::string& name, Role);
73 
74  /* Delivery to a new output owned by this object */
75 
76  Delivery (Session& s, std::shared_ptr<Pannable>, std::shared_ptr<MuteMaster> mm, const std::string& name, Role);
78 
79  bool set_name (const std::string& name);
80  std::string display_name() const;
81 
82  Role role() const { return _role; }
85 
86  void activate ();
87  void deactivate ();
88 
89  void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
90 
91  /* supplemental method used with MIDI */
92 
93  void flush_buffers (samplecnt_t nframes);
96  void realtime_locate (bool);
97 
98  BufferSet& output_buffers() { return *_output_buffers; }
99 
100  PBD::Signal0<void> MuteChange;
101 
102  int set_state (const XMLNode&, int version);
103 
104  /* Panning */
105 
106  static int disable_panners (void);
107  static void reset_panners ();
108 
109  std::shared_ptr<PannerShell> panner_shell() const { return _panshell; }
110  std::shared_ptr<Panner> panner() const;
111 
112  void set_gain_control (std::shared_ptr<GainControl> gc);
113 
114  void set_polarity_control (std::shared_ptr<AutomationControl> ac) {
115  _polarity_control = ac;
116  }
117 
118  void unpan ();
119  void reset_panner ();
122 
123  uint32_t pans_required() const { return _configured_input.n_audio(); }
124  virtual uint32_t pan_outs() const;
125 
126  std::shared_ptr<GainControl> gain_control () const {
127  return _gain_control;
128  }
129 
130  std::shared_ptr<AutomationControl> polarity_control () const {
131  return _polarity_control;
132  }
133 
134  std::shared_ptr<Amp> amp() const {
135  return _amp;
136  }
137 
138 protected:
139  XMLNode& state () const;
140 
144  std::shared_ptr<PannerShell> _panshell;
145  std::shared_ptr<Amp> _amp;
146 
148 
149 private:
151 
152  std::shared_ptr<MuteMaster> _mute_master;
153  std::shared_ptr<GainControl> _gain_control;
154  std::shared_ptr<AutomationControl> _polarity_control;
155 
156  static bool panners_legal;
157  static PBD::Signal0<void> PannersLegal;
158 
161  void output_changed (IOChange, void*);
162 
164 };
165 
166 
167 } // namespace ARDOUR
168 
169 #endif // __ardour__h__
170 
std::shared_ptr< AutomationControl > _polarity_control
Definition: delivery.h:154
uint32_t pans_required() const
Definition: delivery.h:123
static PBD::Signal0< void > PannersLegal
Definition: delivery.h:157
std::shared_ptr< MuteMaster > _mute_master
Definition: delivery.h:152
void set_polarity_control(std::shared_ptr< AutomationControl > ac)
Definition: delivery.h:114
std::shared_ptr< GainControl > gain_control() const
Definition: delivery.h:126
XMLNode & state() const
void realtime_locate(bool)
void no_outs_cuz_we_no_monitor(bool)
bool does_routing() const
Definition: delivery.h:68
void defer_pan_reset()
std::shared_ptr< Panner > panner() const
std::string display_name() const
bool _no_panner_reset
Definition: delivery.h:163
BufferSet & output_buffers()
Definition: delivery.h:98
static bool panners_legal
Definition: delivery.h:156
PBD::ScopedConnection panner_legal_c
Definition: delivery.h:160
gain_t _current_gain
Definition: delivery.h:143
std::shared_ptr< AutomationControl > polarity_control() const
Definition: delivery.h:130
std::shared_ptr< Amp > _amp
Definition: delivery.h:145
std::shared_ptr< PannerShell > panner_shell() const
Definition: delivery.h:109
void set_gain_control(std::shared_ptr< GainControl > gc)
Delivery(Session &s, std::shared_ptr< Pannable >, std::shared_ptr< MuteMaster > mm, const std::string &name, Role)
virtual uint32_t pan_outs() const
std::shared_ptr< Amp > amp() const
Definition: delivery.h:134
gain_t target_gain()
static int disable_panners(void)
BufferSet * _output_buffers
Definition: delivery.h:142
bool configure_io(ChanCount in, ChanCount out)
void panners_became_legal()
void flush_buffers(samplecnt_t nframes)
bool can_support_io_configuration(const ChanCount &in, ChanCount &out)
Role role() const
Definition: delivery.h:82
static bool role_from_xml(const XMLNode &, Role &)
void non_realtime_transport_stop(samplepos_t now, bool flush)
std::shared_ptr< PannerShell > _panshell
Definition: delivery.h:144
void allow_pan_reset()
static void reset_panners()
void run(BufferSet &bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
std::shared_ptr< GainControl > _gain_control
Definition: delivery.h:153
int set_state(const XMLNode &, int version)
void output_changed(IOChange, void *)
Delivery(Session &s, std::shared_ptr< IO > io, std::shared_ptr< Pannable >, std::shared_ptr< MuteMaster > mm, const std::string &name, Role)
bool _no_outs_cuz_we_no_monitor
Definition: delivery.h:150
PBD::Signal0< void > MuteChange
Definition: delivery.h:100
static bool role_requires_output_ports(Role r)
Definition: delivery.h:66
bool set_name(const std::string &name)
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
void flush()