merged with 1697 revision of trunk (which is post-rc1 but pre-rc2
[ardour.git] / libs / ardour / ardour / audio_track.h
1 /*
2     Copyright (C) 2002-2006 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_audio_track_h__
21 #define __ardour_audio_track_h__
22
23 #include <ardour/track.h>
24
25 namespace ARDOUR {
26
27 class Session;
28 class AudioDiskstream;
29 class AudioPlaylist;
30 class RouteGroup;
31
32 class AudioTrack : public Track
33 {
34   public:
35         AudioTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
36         AudioTrack (Session&, const XMLNode&);
37         ~AudioTrack ();
38
39         int set_mode (TrackMode m); 
40         bool can_use_mode (TrackMode m, bool& bounce_required);
41
42         int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
43                 nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
44         
45         int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
46                 nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
47         
48         int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
49                 nframes_t offset, bool can_record, bool rec_monitors_input);
50
51         boost::shared_ptr<AudioDiskstream> audio_diskstream() const;
52
53         int use_diskstream (string name);
54         int use_diskstream (const PBD::ID& id);
55         
56         int export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t nframes, nframes_t end_frame);
57
58         void freeze (InterThreadInfo&);
59         void unfreeze ();
60
61         void bounce (InterThreadInfo&);
62         void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&);
63
64         int set_state(const XMLNode& node);
65
66   protected:
67         XMLNode& state (bool full);
68
69         void passthru_silence (nframes_t start_frame, nframes_t end_frame, 
70                                nframes_t nframes, nframes_t offset, int declick,
71                                bool meter);
72
73         uint32_t n_process_buffers ();
74
75         int _set_state (const XMLNode&, bool call_base);
76         
77   private:
78         int  set_diskstream (boost::shared_ptr<AudioDiskstream>, void *);
79         int  deprecated_use_diskstream_connections ();
80         void set_state_part_two ();
81         void set_state_part_three ();
82 };
83
84 } // namespace ARDOUR
85
86 #endif /* __ardour_audio_track_h__ */