2 Copyright (C) 2000 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 <sigc++/signal.h>
31 #include "ardour/ardour.h"
32 #include "ardour/automatable_controls.h"
33 #include "ardour/buffer_set.h"
34 #include "ardour/latent.h"
35 #include "ardour/session_object.h"
36 #include "ardour/types.h"
45 /* A mixer strip element - plugin, send, meter, etc.
47 class Processor : public SessionObject, public AutomatableControls, public Latent
50 static const string state_node_name;
52 Processor(Session&, const string& name, Placement p); // TODO: remove placement (use sort key)
54 virtual ~Processor() { }
56 uint32_t sort_key() const { return _sort_key; }
57 void set_sort_key (uint32_t key);
59 Placement placement() const { return _placement; }
60 void set_placement (Placement);
62 bool active () const { return _active; }
64 bool get_next_ab_is_active () const { return _next_ab_is_active; }
65 void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
67 virtual nframes_t signal_latency() const { return 0; }
69 virtual void transport_stopped (nframes_t frame) {}
71 virtual void set_block_size (nframes_t nframes) {}
73 virtual void run_in_place (BufferSet& bufs,
74 nframes_t start_frame, nframes_t end_frame,
75 nframes_t nframes, nframes_t offset) { assert(is_in_place()); }
77 virtual void run_out_of_place (BufferSet& input, BufferSet& output,
78 nframes_t start_frame, nframes_t end_frame,
79 nframes_t nframes, nframes_t offset) { assert(is_out_of_place()); }
81 virtual void silence (nframes_t nframes, nframes_t offset) {}
83 void activate () { _active = true; ActiveChanged(); }
84 void deactivate () { _active = false; ActiveChanged(); }
86 virtual bool configure_io (ChanCount in, ChanCount out);
88 /* Derived classes should override these, or processor appears as an in-place pass-through */
90 /** In-place processors implement run_in_place and modify thee input buffer parameter */
91 virtual bool is_in_place () const { return true; }
93 /* Out-Of-Place processors implement run_out_of_place, don't modify the input parameter
94 * and write to their output parameter */
95 virtual bool is_out_of_place () const { return false; }
97 virtual bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const = 0;
98 virtual ChanCount output_streams() const { return _configured_input; }
99 virtual ChanCount input_streams () const { return _configured_input; }
101 virtual XMLNode& state (bool full);
102 virtual XMLNode& get_state (void);
103 virtual int set_state (const XMLNode&);
105 void *get_gui () const { return _gui; }
106 void set_gui (void *p) { _gui = p; }
108 static sigc::signal<void,Processor*> ProcessorCreated;
110 sigc::signal<void> ActiveChanged;
111 sigc::signal<void> PlacementChanged;
116 bool _next_ab_is_active;
118 ChanCount _configured_input;
119 Placement _placement;
121 void* _gui; /* generic, we don't know or care what this is */
124 } // namespace ARDOUR
126 #endif /* __ardour_processor_h__ */