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/types.h"
25 #include "ardour/chan_count.h"
26 #include "ardour/io_processor.h"
35 class Delivery : public IOProcessor
39 /* main outputs - delivers out-of-place to port buffers, and cannot be removed */
41 /* send - delivers to port buffers, leaves input buffers untouched */
43 /* insert - delivers to port buffers and receives in-place from port buffers */
45 /* listen - internal send used only to deliver to control/monitor bus */
47 /* aux - internal send used to deliver to any bus, by user request */
49 /* main listen - internal send used only to deliver from master to control/monitor bus */
53 static bool role_requires_output_ports (Role r) { return r == Main || r == Send || r == Insert; }
55 /* Delivery to an existing output */
57 Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
58 Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
60 /* Delivery to a new output owned by this object */
62 Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
63 Delivery (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
66 bool set_name (const std::string& name);
67 std::string display_name() const;
69 Role role() const { return _role; }
70 bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
71 bool configure_io (ChanCount in, ChanCount out);
73 void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
75 /* supplemental method used with MIDI */
77 void flush (nframes_t nframes, nframes64_t time);
78 void transport_stopped ();
80 void no_outs_cuz_we_no_monitor(bool);
82 void set_solo_level (int32_t sl) { _solo_level = sl; }
83 void set_solo_isolated (bool yn) { _solo_isolated = yn; }
85 void cycle_start (nframes_t);
86 void increment_output_offset (nframes_t);
87 void transport_stopped (sframes_t frame);
89 BufferSet& output_buffers() { return *_output_buffers; }
91 PBD::Signal0<void> MuteChange;
93 static PBD::Signal1<void,nframes_t> CycleStart;
95 XMLNode& state (bool full);
96 int set_state (const XMLNode&, int version);
100 static int disable_panners (void);
101 static int reset_panners (void);
103 boost::shared_ptr<Panner> panner() const { return _panner; }
105 void reset_panner ();
106 void defer_pan_reset ();
107 void allow_pan_reset ();
109 uint32_t pans_required() const { return _configured_input.n_audio(); }
110 void start_pan_touch (uint32_t which);
111 void end_pan_touch (uint32_t which);
115 BufferSet* _output_buffers;
116 gain_t _current_gain;
117 nframes_t _output_offset;
118 bool _no_outs_cuz_we_no_monitor;
119 uint32_t _solo_level;
121 boost::shared_ptr<MuteMaster> _mute_master;
122 bool no_panner_reset;
123 boost::shared_ptr<Panner> _panner;
125 static bool panners_legal;
126 static PBD::Signal0<int> PannersLegal;
128 int panners_became_legal ();
129 PBD::ScopedConnection panner_legal_c;
130 void output_changed (IOChange, void*);
132 gain_t target_gain ();
136 } // namespace ARDOUR
138 #endif // __ardour__h__