Remove stub class.
[ardour.git] / libs / ardour / ardour / processor.h
1 /*
2     Copyright (C) 2009-2010 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_processor_h__
21 #define __ardour_processor_h__
22
23 #include <vector>
24 #include <string>
25 #include <exception>
26
27 #include "pbd/statefuldestructible.h"
28
29 #include "ardour/ardour.h"
30 #include "ardour/buffer_set.h"
31 #include "ardour/latent.h"
32 #include "ardour/session_object.h"
33 #include "ardour/types.h"
34 #include "ardour/automatable.h"
35
36 class XMLNode;
37
38 namespace ARDOUR {
39
40 class Session;
41 class Route;
42
43 /* A mixer strip element - plugin, send, meter, etc.
44  */
45 class Processor : public SessionObject, public Automatable, public Latent
46 {
47   public:
48         static const std::string state_node_name;
49
50         Processor(Session&, const std::string& name);
51
52         virtual ~Processor() { }
53
54         virtual std::string display_name() const { return SessionObject::name(); }
55
56         virtual bool display_to_user() const { return _display_to_user; }
57         virtual void set_display_to_user (bool);
58
59         bool active () const { return _pending_active; }
60
61         bool get_next_ab_is_active () const { return _next_ab_is_active; }
62         void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
63
64         virtual nframes_t signal_latency() const { return 0; }
65
66         virtual void transport_stopped (sframes_t /*frame*/) {}
67
68         virtual void set_block_size (nframes_t /*nframes*/) {}
69
70         /** @param result_required true if, on return from this method, bufs is required to contain valid data;
71          *  if false, the method need not bother writing to bufs if it doesn't want to.
72          */  
73         virtual void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/, bool result_required) {}
74         virtual void silence (nframes_t /*nframes*/) {}
75
76         virtual void activate ()   { _pending_active = true; ActiveChanged(); }
77         virtual void deactivate () { _pending_active = false; ActiveChanged(); }
78
79         virtual bool configure_io (ChanCount in, ChanCount out);
80
81         /* Derived classes should override these, or processor appears as an in-place pass-through */
82
83         virtual bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const = 0;
84         virtual ChanCount input_streams () const { return _configured_input; }
85         virtual ChanCount output_streams() const { return _configured_output; }
86
87         /* note: derived classes should implement state(), NOT get_state(), to allow
88            us to merge C++ inheritance and XML lack-of-inheritance reasonably
89            smoothly.
90          */
91
92         virtual XMLNode& state (bool full);
93         XMLNode& get_state (void);
94         int set_state (const XMLNode&, int version);
95         
96         void *get_gui () const { return _gui; }
97         void  set_gui (void *p) { _gui = p; }
98
99         void set_pre_fader (bool);
100
101         PBD::Signal0<void>                     ActiveChanged;
102         PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged;
103
104 protected:
105         int       _pending_active;
106         bool      _active;
107         bool      _next_ab_is_active;
108         bool      _configured;
109         ChanCount _configured_input;
110         ChanCount _configured_output;
111         void*     _gui;  /* generic, we don't know or care what this is */
112         bool      _display_to_user;
113         bool      _pre_fader;
114
115 private:
116         int set_state_2X (const XMLNode&, int version);
117 };
118
119 } // namespace ARDOUR
120
121 #endif /* __ardour_processor_h__ */