2 Copyright (C) 2009-2010 Paul Davis
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.
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.
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.
20 #ifndef __ardour_processor_h__
21 #define __ardour_processor_h__
27 #include "pbd/statefuldestructible.h"
30 #include "ardour/ardour.h"
31 #include "ardour/automatable_controls.h"
32 #include "ardour/buffer_set.h"
33 #include "ardour/latent.h"
34 #include "ardour/session_object.h"
35 #include "ardour/types.h"
44 /* A mixer strip element - plugin, send, meter, etc.
46 class Processor : public SessionObject, public AutomatableControls, public Latent
49 static const std::string state_node_name;
51 Processor(Session&, const std::string& name);
53 virtual ~Processor() { }
55 virtual std::string display_name() const { return SessionObject::name(); }
57 virtual bool display_to_user() const { return _display_to_user; }
58 virtual void set_display_to_user (bool);
60 bool active () const { return _pending_active; }
62 bool get_next_ab_is_active () const { return _next_ab_is_active; }
63 void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
65 virtual nframes_t signal_latency() const { return 0; }
67 virtual void transport_stopped (sframes_t /*frame*/) {}
69 virtual void set_block_size (nframes_t /*nframes*/) {}
71 /** @param result_required true if, on return from this method, bufs is required to contain valid data;
72 * if false, the method need not bother writing to bufs if it doesn't want to.
74 virtual void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/, bool result_required) {}
75 virtual void silence (nframes_t /*nframes*/) {}
77 virtual void activate () { _pending_active = true; ActiveChanged(); }
78 virtual void deactivate () { _pending_active = false; ActiveChanged(); }
80 virtual bool configure_io (ChanCount in, ChanCount out);
82 /* Derived classes should override these, or processor appears as an in-place pass-through */
84 virtual bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const = 0;
85 virtual ChanCount input_streams () const { return _configured_input; }
86 virtual ChanCount output_streams() const { return _configured_output; }
88 /* note: derived classes should implement state(), NOT get_state(), to allow
89 us to merge C++ inheritance and XML lack-of-inheritance reasonably
93 virtual XMLNode& state (bool full);
94 XMLNode& get_state (void);
95 int set_state (const XMLNode&, int version);
97 void *get_gui () const { return _gui; }
98 void set_gui (void *p) { _gui = p; }
100 void set_pre_fader (bool);
102 PBD::Signal0<void> ActiveChanged;
103 PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged;
108 bool _next_ab_is_active;
110 ChanCount _configured_input;
111 ChanCount _configured_output;
112 void* _gui; /* generic, we don't know or care what this is */
113 bool _display_to_user;
117 int set_state_2X (const XMLNode&, int version);
120 } // namespace ARDOUR
122 #endif /* __ardour_processor_h__ */