fb350b88381ffe5b77bbc14bb3a87961e4febc1b
[ardour.git] / libs / ardour / ardour / midi_track.h
1 /*
2     Copyright (C) 2006 Paul Davis 
3         Written by Dave Robillard
4  
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9  
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14  
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __ardour_midi_track_h__
21 #define __ardour_midi_track_h__
22
23 #include <ardour/track.h>
24
25 namespace ARDOUR
26 {
27
28 class Session;
29 class MidiDiskstream;
30 class MidiPlaylist;
31 class RouteGroup;
32
33 class MidiTrack : public Track
34 {
35 public:
36         MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
37         MidiTrack (Session&, const XMLNode&);
38         ~MidiTrack ();
39         
40         int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
41                 nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
42         
43         int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
44                 nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
45         
46         int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
47                 nframes_t offset, bool can_record, bool rec_monitors_input);
48
49         void process_output_buffers (BufferSet& bufs,
50                                      nframes_t start_frame, nframes_t end_frame,
51                                      nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
52                                      bool meter);
53
54         boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
55
56         int use_diskstream (string name);
57         int use_diskstream (const PBD::ID& id);
58
59         int set_mode (TrackMode m);
60
61         void set_latency_delay (nframes_t);
62
63         int export_stuff (BufferSet& bufs,
64                 nframes_t nframes, nframes_t end_frame);
65
66         void freeze (InterThreadInfo&);
67         void unfreeze ();
68
69         void bounce (InterThreadInfo&);
70         void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&);
71
72         int set_state(const XMLNode& node);
73
74 protected:
75         XMLNode& state (bool full);
76         
77         int _set_state (const XMLNode&, bool call_base);
78
79 private:
80         int set_diskstream (boost::shared_ptr<MidiDiskstream> ds);
81         void set_state_part_two ();
82         void set_state_part_three ();
83 };
84
85 } /* namespace ARDOUR*/
86
87 #endif /* __ardour_midi_track_h__ */