solo models work again (amazing how hard this was); remove crufty debug output; remov...
[ardour.git] / libs / ardour / ardour / delivery.h
1 /*
2     Copyright (C) 2006 Paul Davis 
3     
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)
7     any later version.
8     
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
12     for more details.
13     
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.
17 */
18
19 #ifndef __ardour_delivery_h__
20 #define __ardour_delivery_h__
21
22 #include <string>
23 #include "ardour/types.h"
24 #include "ardour/chan_count.h"
25 #include "ardour/io_processor.h"
26
27 namespace ARDOUR {
28
29 class BufferSet;
30 class IO;
31 class MuteMaster;
32 class Panner;
33
34 class Delivery : public IOProcessor {
35 public:
36         enum Role {
37                 Insert = 0x1,
38                 Send   = 0x2,
39                 Listen = 0x4,
40                 Main   = 0x8
41         };
42
43         /* Delivery to an existing output */
44
45         Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
46         Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
47
48         /* Delivery to a new output owned by this object */
49
50         Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
51         Delivery (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
52
53         bool set_name (const std::string& name);
54         bool visible() const;
55         Role role() const { return _role; }
56         bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
57         bool configure_io (ChanCount in, ChanCount out);
58
59         void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
60
61         /* supplemental method use with MIDI */
62
63         void flush (nframes_t nframes);
64
65         void no_outs_cuz_we_no_monitor(bool);
66
67         void set_solo_level (int32_t sl) { _solo_level = sl; }
68         void set_solo_isolated (bool yn) { _solo_isolated = yn; }
69
70         void cycle_start (nframes_t);
71         void increment_output_offset (nframes_t);
72         void transport_stopped (sframes_t frame);
73
74         BufferSet& output_buffers() { return *_output_buffers; }
75
76         sigc::signal<void> MuteChange;
77
78         static sigc::signal<void,nframes_t> CycleStart;
79
80         XMLNode& state (bool full);
81         int set_state (const XMLNode&);
82
83         /* Panning */
84
85         static int  disable_panners (void);
86         static int  reset_panners (void);
87
88         boost::shared_ptr<Panner> panner() const { return _panner; }
89
90         void reset_panner ();
91         void defer_pan_reset ();
92         void allow_pan_reset ();
93
94         uint32_t pans_required() const { return _configured_input.n_audio(); }
95         void start_pan_touch (uint32_t which);
96         void end_pan_touch (uint32_t which);
97
98   protected:
99         Role        _role;
100         BufferSet*  _output_buffers;
101         gain_t      _current_gain;
102         nframes_t   _output_offset;
103         bool        _no_outs_cuz_we_no_monitor;
104         uint32_t    _solo_level;
105         bool        _solo_isolated;
106         boost::shared_ptr<MuteMaster> _mute_master;
107         bool         no_panner_reset;
108         boost::shared_ptr<Panner> _panner;
109
110         static bool panners_legal;
111         static sigc::signal<int>            PannersLegal;
112
113         int panners_became_legal ();
114         sigc::connection panner_legal_c;
115         void output_changed (IOChange, void*);
116
117         gain_t target_gain ();
118 };
119
120
121 } // namespace ARDOUR
122
123 #endif // __ardour__h__
124