first part of MIDI cut/copy/paste ; fix for input/output_streams of an IOProcessor...
[ardour.git] / libs / ardour / ardour / io_processor.h
1 /*
2     Copyright (C) 2001 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_redirect_h__
21 #define __ardour_redirect_h__
22
23 #include <string>
24 #include <boost/shared_ptr.hpp>
25 #include <sigc++/signal.h>
26
27 #include <glibmm/thread.h>
28
29 #include "pbd/undo.h"
30
31 #include "ardour/ardour.h"
32 #include "ardour/processor.h"
33
34 class XMLNode;
35
36 namespace ARDOUR {
37
38 class Session;
39 class IO;
40 class Route;
41
42 /** A mixer strip element (Processor) with 1 or 2 IO elements.
43  */
44 class IOProcessor : public Processor
45 {
46   public:
47         IOProcessor (Session&, bool with_input, bool with_output,
48                      const std::string& proc_name, const std::string io_name="",
49                      ARDOUR::DataType default_type = DataType::AUDIO);
50         IOProcessor (Session&, boost::shared_ptr<IO> input, boost::shared_ptr<IO> output,
51                      const std::string& proc_name, ARDOUR::DataType default_type = DataType::AUDIO);
52         virtual ~IOProcessor ();
53         
54         bool set_name (const std::string& str);
55
56         virtual ChanCount natural_output_streams() const;
57         virtual ChanCount natural_input_streams () const;
58
59         boost::shared_ptr<IO>       input()       { return _input; }
60         boost::shared_ptr<const IO> input() const { return _input; }
61         boost::shared_ptr<IO>       output()       { return _output; }
62         boost::shared_ptr<const IO> output() const { return _output; }
63         void set_input (boost::shared_ptr<IO>);
64         void set_output (boost::shared_ptr<IO>);
65         
66         void silence (nframes_t nframes);
67         void disconnect ();
68
69         virtual bool feeds (boost::shared_ptr<Route> other) const;
70
71         sigc::signal<void,IOProcessor*,bool>     AutomationPlaybackChanged;
72         sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged;
73         
74         XMLNode& state (bool full_state);
75         int set_state (const XMLNode&);
76         
77   protected:
78         boost::shared_ptr<IO> _input;
79         boost::shared_ptr<IO> _output;
80
81   private:
82         /* disallow copy construction */
83         IOProcessor (const IOProcessor&);
84         bool _own_input;
85         bool _own_output;
86
87 };
88
89 } // namespace ARDOUR
90
91 #endif /* __ardour_redirect_h__ */