Merged with trunk R992.
[ardour.git] / libs / ardour / ardour / export.h
1 #ifndef __ardour_export_h__
2 #define __ardour_export_h__
3
4 #include <map>
5 #include <vector>
6 #include <string>
7
8 #include <sigc++/signal.h>
9
10 #include <sndfile.h>
11 #include <samplerate.h>
12
13 #include <ardour/ardour.h>
14 #include <ardour/gdither.h>
15
16 using std::map;
17 using std::vector;
18 using std::string;
19 using std::pair;
20
21 namespace ARDOUR 
22 {
23         class Port;
24
25         typedef pair<Port *, uint32_t> PortChannelPair;
26         typedef map<uint32_t, vector<PortChannelPair> > AudioExportPortMap;
27
28         struct AudioExportSpecification : public SF_INFO, public sigc::trackable {
29
30             AudioExportSpecification();
31             ~AudioExportSpecification ();
32
33             void init ();
34             void clear ();
35
36
37             int prepare (nframes_t blocksize, nframes_t frame_rate);
38
39             int process (nframes_t nframes);
40
41             /* set by the user */
42
43             string              path;
44             nframes_t      sample_rate;
45
46             int                 src_quality;
47             SNDFILE*            out;
48             uint32_t       channels;
49             AudioExportPortMap  port_map;
50             nframes_t      start_frame;
51             nframes_t      end_frame;
52             GDitherType         dither_type;
53             bool                do_freewheel;
54
55             /* used exclusively during export */
56
57             nframes_t      frame_rate;
58             GDither             dither;
59             float*              dataF;
60             float*              dataF2;
61             float*              leftoverF;
62             nframes_t      leftover_frames;
63             nframes_t      max_leftover_frames;
64             void*               output_data;
65             nframes_t      out_samples_max;
66             uint32_t        sample_bytes;
67             uint32_t        data_width;
68
69             nframes_t      total_frames;
70             SF_INFO             sfinfo;
71             SRC_DATA            src_data;
72             SRC_STATE*          src_state;
73             nframes_t      pos;
74
75             sigc::connection    freewheel_connection;
76
77             /* shared between UI thread and audio thread */
78
79             float progress;  /* audio thread sets this */
80             bool  stop;      /* UI sets this */
81             bool  running;   /* audio thread sets to false when export is done */
82
83             int   status;
84
85         };
86 } // namespace ARDOUR
87
88 #endif /* __ardour_export_h__ */