add new sigc++2 directory
[ardour.git] / libs / ardour / ardour / export.h
1 /*
2     Copyright (C) 2000-2007 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_export_h__
21 #define __ardour_export_h__
22
23 #include <map>
24 #include <vector>
25 #include <string>
26
27 #include <sigc++/signal.h>
28
29 #include <sndfile.h>
30 #include <samplerate.h>
31
32 #include <ardour/ardour.h>
33 #include <ardour/gdither.h>
34
35 using std::map;
36 using std::vector;
37 using std::string;
38 using std::pair;
39
40 namespace ARDOUR 
41 {
42         class Port;
43
44         typedef pair<Port *, uint32_t> PortChannelPair;
45         typedef map<uint32_t, vector<PortChannelPair> > ExportPortMap;
46
47         struct ExportSpecification : public SF_INFO, public sigc::trackable {
48
49             ExportSpecification();
50             ~ExportSpecification ();
51
52             void init ();
53             void clear ();
54
55
56             int prepare (nframes_t blocksize, nframes_t frame_rate);
57
58             int process (nframes_t nframes);
59
60             /* set by the user */
61
62             string              path;
63             nframes_t      sample_rate;
64
65             int            src_quality;
66             SNDFILE*       out;
67             uint32_t       channels;
68             ExportPortMap  port_map;
69             nframes_t      start_frame;
70             nframes_t      end_frame;
71             GDitherType    dither_type;
72             bool           do_freewheel;
73
74             /* used exclusively during export */
75
76             nframes_t      frame_rate;
77             GDither        dither;
78             float*         dataF;
79             float*         dataF2;
80             float*         leftoverF;
81             nframes_t      leftover_frames;
82             nframes_t      max_leftover_frames;
83             void*          output_data;
84             nframes_t      out_samples_max;
85             uint32_t       sample_bytes;
86             uint32_t       data_width;
87
88             nframes_t      total_frames;
89             SF_INFO        sfinfo;
90             SRC_DATA       src_data;
91             SRC_STATE*     src_state;
92             nframes_t      pos;
93
94             sigc::connection freewheel_connection;
95
96             /* shared between UI thread and audio thread */
97
98             volatile float progress;  /* audio thread sets this */
99             volatile bool  stop;      /* UI sets this */
100             volatile bool  running;   /* audio thread sets to false when export is done */
101
102             int status;
103         };
104
105 } // namespace ARDOUR
106
107 #endif /* __ardour_export_h__ */