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