ardour
processor.h
Go to the documentation of this file.
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 
28 
29 #include "ardour/ardour.h"
30 #include "ardour/buffer_set.h"
31 #include "ardour/latent.h"
32 #include "ardour/session_object.h"
34 #include "ardour/types.h"
35 #include "ardour/automatable.h"
36 
37 class XMLNode;
39 
40 namespace ARDOUR {
41 
42 class Session;
43 class Route;
44 
46 class LIBARDOUR_API Processor : public SessionObject, public Automatable, public Latent
47 {
48  public:
49  static const std::string state_node_name;
50 
51  Processor(Session&, const std::string& name);
52  Processor (const Processor& other);
53 
54  virtual ~Processor() { }
55 
56  virtual std::string display_name() const { return SessionObject::name(); }
57 
58  virtual bool display_to_user() const { return _display_to_user; }
59  virtual void set_display_to_user (bool);
60 
61  bool active () const { return _pending_active; }
62 
63  virtual bool does_routing() const { return false; }
64 
65  bool get_next_ab_is_active () const { return _next_ab_is_active; }
66  void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
67 
68  virtual framecnt_t signal_latency() const { return 0; }
69 
70  virtual int set_block_size (pframes_t /*nframes*/) { return 0; }
71  virtual bool requires_fixed_sized_buffers() const { return false; }
72 
76  virtual void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/) {}
77  virtual void silence (framecnt_t /*nframes*/) {}
78 
79  virtual void activate () { _pending_active = true; ActiveChanged(); }
80  virtual void deactivate () { _pending_active = false; ActiveChanged(); }
81  virtual void flush() {}
82 
83  virtual bool configure_io (ChanCount in, ChanCount out);
84 
85  /* Derived classes should override these, or processor appears as an in-place pass-through */
86 
87  virtual bool can_support_io_configuration (const ChanCount& in, ChanCount& out) = 0;
88  virtual ChanCount input_streams () const { return _configured_input; }
89  virtual ChanCount output_streams() const { return _configured_output; }
90 
92  virtual void realtime_locate () {}
93 
94  /* most processors won't care about this, but plugins that
95  receive MIDI or similar data from an input source that
96  may suddenly go "quiet" because of monitoring changes
97  need to know about it.
98  */
99  virtual void monitoring_changed() {}
100 
101  /* note: derived classes should implement state(), NOT get_state(), to allow
102  us to merge C++ inheritance and XML lack-of-inheritance reasonably
103  smoothly.
104  */
105 
106  virtual XMLNode& state (bool full);
107  XMLNode& get_state (void);
108  int set_state (const XMLNode&, int version);
109 
110  void set_pre_fader (bool);
111 
112  PBD::Signal0<void> ActiveChanged;
113  PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged;
114 
115  void set_ui (void*);
116  void* get_ui () const { return _ui_pointer; }
117 
118  ProcessorWindowProxy * window_proxy () const { return _window_proxy; }
119  void set_window_proxy (ProcessorWindowProxy* wp);
120 
121  void set_owner (SessionObject*);
122  SessionObject* owner() const;
123 
124 protected:
125  virtual int set_state_2X (const XMLNode&, int version);
126 
128  bool _active;
134  bool _pre_fader;
135  void* _ui_pointer;
138 };
139 
140 } // namespace ARDOUR
141 
142 #endif /* __ardour_processor_h__ */
bool _pre_fader
true if this processor is currently placed before the Amp, otherwise false
Definition: processor.h:134
void set_next_ab_is_active(bool yn)
Definition: processor.h:66
virtual void realtime_locate()
Definition: processor.h:92
uint32_t pframes_t
Definition: types.h:61
void * get_ui() const
Definition: processor.h:116
PBD::Signal2< void, ChanCount, ChanCount > ConfigurationChanged
Definition: processor.h:113
ProcessorWindowProxy * _window_proxy
Definition: processor.h:136
virtual void flush()
Definition: processor.h:81
virtual int set_block_size(pframes_t)
Definition: processor.h:70
ChanCount _configured_output
Definition: processor.h:132
virtual void deactivate()
Definition: processor.h:80
virtual std::string display_name() const
Definition: processor.h:56
bool get_next_ab_is_active() const
Definition: processor.h:65
virtual void silence(framecnt_t)
Definition: processor.h:77
bool _next_ab_is_active
Definition: processor.h:129
static const std::string state_node_name
Definition: processor.h:49
int64_t framecnt_t
Definition: types.h:76
virtual void realtime_handle_transport_stopped()
Definition: processor.h:91
virtual void monitoring_changed()
Definition: processor.h:99
SessionObject * _owner
Definition: processor.h:137
Definition: amp.h:29
virtual bool does_routing() const
Definition: processor.h:63
int64_t framepos_t
Definition: types.h:66
ProcessorWindowProxy * window_proxy() const
Definition: processor.h:118
#define LIBARDOUR_API
virtual bool display_to_user() const
Definition: processor.h:58
virtual ~Processor()
Definition: processor.h:54
const char * name
Definition: xml++.h:95
std::string name() const
PBD::Signal0< void > ActiveChanged
Definition: processor.h:112
virtual void activate()
Definition: processor.h:79
virtual bool requires_fixed_sized_buffers() const
Definition: processor.h:71
virtual ChanCount input_streams() const
Definition: processor.h:88
bool active() const
Definition: processor.h:61
virtual void run(BufferSet &, framepos_t, framepos_t, pframes_t, bool)
Definition: processor.h:76
virtual framecnt_t signal_latency() const
Definition: processor.h:68
ChanCount _configured_input
Definition: processor.h:131
void * _ui_pointer
Definition: processor.h:135
virtual ChanCount output_streams() const
Definition: processor.h:89