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"
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/libardour_visibility.h"
34 #include "ardour/types.h"
35 #include "ardour/automatable.h"
38 class ProcessorWindowProxy;
39 class PluginPinWindowProxy;
46 /** A mixer strip element - plugin, send, meter, etc */
47 class LIBARDOUR_API Processor : public SessionObject, public Automatable, public Latent
50 static const std::string state_node_name;
52 Processor(Session&, const std::string& name);
53 Processor (const Processor& other);
55 virtual ~Processor() { }
57 virtual std::string display_name() const { return SessionObject::name(); }
59 virtual bool display_to_user() const { return _display_to_user; }
60 virtual void set_display_to_user (bool);
62 bool active () const { return _pending_active; }
64 virtual bool does_routing() const { return false; }
66 bool get_next_ab_is_active () const { return _next_ab_is_active; }
67 void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
69 virtual framecnt_t signal_latency() const { return 0; }
71 virtual int set_block_size (pframes_t /*nframes*/) { return 0; }
72 virtual bool requires_fixed_sized_buffers() const { return false; }
74 /** @param result_required true if, on return from this method, @a bufs is required to contain valid data;
75 * if false, the method need not bother writing to @a bufs if it doesn't want to.
77 virtual void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/) {}
78 virtual void silence (framecnt_t /*nframes*/) {}
80 virtual void activate () { _pending_active = true; ActiveChanged(); }
81 virtual void deactivate () { _pending_active = false; ActiveChanged(); }
82 virtual void flush() {}
84 virtual bool configure_io (ChanCount in, ChanCount out);
86 /* Derived classes should override these, or processor appears as an in-place pass-through */
88 virtual bool can_support_io_configuration (const ChanCount& in, ChanCount& out) = 0;
89 virtual ChanCount input_streams () const { return _configured_input; }
90 virtual ChanCount output_streams() const { return _configured_output; }
92 virtual void realtime_handle_transport_stopped () {}
93 virtual void realtime_locate () {}
95 /* most processors won't care about this, but plugins that
96 receive MIDI or similar data from an input source that
97 may suddenly go "quiet" because of monitoring changes
98 need to know about it.
100 virtual void monitoring_changed() {}
102 /* note: derived classes should implement state(), NOT get_state(), to allow
103 us to merge C++ inheritance and XML lack-of-inheritance reasonably
107 virtual XMLNode& state (bool full);
108 XMLNode& get_state (void);
109 int set_state (const XMLNode&, int version);
111 virtual void set_pre_fader (bool);
113 PBD::Signal0<void> ActiveChanged;
114 PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged;
117 void* get_ui () const { return _ui_pointer; }
119 ProcessorWindowProxy * window_proxy () const { return _window_proxy; }
120 void set_window_proxy (ProcessorWindowProxy* wp) { _window_proxy = wp; }
122 PluginPinWindowProxy * pinmgr_proxy () const { return _pinmgr_proxy; }
123 void set_pingmgr_proxy (PluginPinWindowProxy* wp) { _pinmgr_proxy = wp ; }
125 void set_owner (SessionObject*);
126 SessionObject* owner() const;
129 virtual int set_state_2X (const XMLNode&, int version);
133 bool _next_ab_is_active;
135 ChanCount _configured_input;
136 ChanCount _configured_output;
137 bool _display_to_user;
138 bool _pre_fader; ///< true if this processor is currently placed before the Amp, otherwise false
140 ProcessorWindowProxy *_window_proxy;
141 PluginPinWindowProxy *_pinmgr_proxy;
142 SessionObject* _owner;
145 } // namespace ARDOUR
147 #endif /* __ardour_processor_h__ */