2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2 of the License, or (at your option)
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __ardour_delivery_h__
20 #define __ardour_delivery_h__
24 #include "ardour/libardour_visibility.h"
25 #include "ardour/types.h"
26 #include "ardour/chan_count.h"
27 #include "ardour/io_processor.h"
38 class LIBARDOUR_API Delivery : public IOProcessor
42 /* main outputs - delivers out-of-place to port buffers, and cannot be removed */
44 /* send - delivers to port buffers, leaves input buffers untouched */
46 /* insert - delivers to port buffers and receives in-place from port buffers */
48 /* listen - internal send used only to deliver to control/monitor bus */
50 /* aux - internal send used to deliver to any bus, by user request */
52 /* personal - internal send used only to deliver to a personal monitor bus */
56 static bool role_requires_output_ports (Role r) { return r == Main || r == Send || r == Insert; }
58 bool does_routing() const { return true; }
60 /* Delivery to an existing output */
62 Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
64 /* Delivery to a new output owned by this object */
66 Delivery (Session& s, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
69 bool set_name (const std::string& name);
70 std::string display_name() const;
72 Role role() const { return _role; }
73 bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
74 bool configure_io (ChanCount in, ChanCount out);
76 void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
78 /* supplemental method used with MIDI */
80 void flush_buffers (samplecnt_t nframes);
81 void no_outs_cuz_we_no_monitor(bool);
82 void non_realtime_transport_stop (samplepos_t now, bool flush);
83 void realtime_locate ();
85 BufferSet& output_buffers() { return *_output_buffers; }
87 PBD::Signal0<void> MuteChange;
89 int set_state (const XMLNode&, int version);
93 static int disable_panners (void);
94 static void reset_panners ();
96 boost::shared_ptr<PannerShell> panner_shell() const { return _panshell; }
97 boost::shared_ptr<Panner> panner() const;
100 void reset_panner ();
101 void defer_pan_reset ();
102 void allow_pan_reset ();
104 uint32_t pans_required() const { return _configured_input.n_audio(); }
105 virtual uint32_t pan_outs() const;
111 BufferSet* _output_buffers;
112 gain_t _current_gain;
113 boost::shared_ptr<PannerShell> _panshell;
115 gain_t target_gain ();
118 bool _no_outs_cuz_we_no_monitor;
119 boost::shared_ptr<MuteMaster> _mute_master;
121 static bool panners_legal;
122 static PBD::Signal0<void> PannersLegal;
124 void panners_became_legal ();
125 PBD::ScopedConnection panner_legal_c;
126 void output_changed (IOChange, void*);
128 bool _no_panner_reset;
132 } // namespace ARDOUR
134 #endif // __ardour__h__