Remove most using declarations from header files.
[ardour.git] / libs / ardour / ardour / export_timespan.h
1 /*
2     Copyright (C) 2008 Paul Davis
3     Author: Sakari Bergen
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
21 #ifndef __ardour_export_timespan_h__
22 #define __ardour_export_timespan_h__
23
24 #include <map>
25 #include <list>
26
27 #include <glibmm/ustring.h>
28
29 #include "ardour/export_status.h"
30 #include "ardour/export_channel.h"
31 #include "ardour/ardour.h"
32
33 namespace ARDOUR
34 {
35
36 class ExportChannel;
37 class ExportTempFile;
38
39 class ExportTimespan : public sigc::trackable
40 {
41   private:
42         typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
43         typedef std::pair<ExportChannelPtr, TempFilePtr> ChannelFilePair;
44         typedef std::map<ExportChannelPtr, TempFilePtr> TempFileMap;
45         typedef boost::shared_ptr<ExportStatus> ExportStatusPtr;
46
47   private:
48         friend class ExportElementFactory;
49         ExportTimespan (ExportStatusPtr status, nframes_t frame_rate);
50         
51   public:
52         ~ExportTimespan ();
53         
54         Glib::ustring name () const { return _name; }
55         void set_name (Glib::ustring name) { _name = name; }
56         
57         Glib::ustring range_id () const { return _range_id; }
58         void set_range_id (Glib::ustring range_id) { _range_id = range_id; }
59         
60         /// Registers a channel to be read when export starts rolling
61         void register_channel (ExportChannelPtr channel);
62         
63         /// "Rewinds" the tempfiles to start reading the beginnings again
64         void rewind ();
65         
66         /// Reads data from the tempfile belonging to channel into data
67         nframes_t get_data (float * data, nframes_t frames, ExportChannelPtr channel);
68         
69         /// Reads data from each channel and writes to tempfile
70         int process (nframes_t frames);
71         
72         sigc::connection  process_connection;
73         
74         void set_range (nframes_t start, nframes_t end);
75         nframes_t get_length () const { return end_frame - start_frame; }
76         nframes_t get_start () const { return start_frame; }
77         nframes_t get_end () const { return end_frame; }
78
79   private:
80
81         ExportStatusPtr status;
82
83         nframes_t      start_frame;
84         nframes_t      end_frame;
85         nframes_t      position;
86         nframes_t      frame_rate;
87
88         TempFileMap    filemap;
89         
90         Glib::ustring _name;
91         Glib::ustring _range_id;
92
93 };
94
95 } // namespace ARDOUR
96
97 #endif /* __ardour_export_timespan_h__ */