2 Copyright (C) 2008 Paul Davis
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.
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.
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.
21 #ifndef __ardour_export_processor_h__
22 #define __ardour_export_processor_h__
26 #include <boost/smart_ptr.hpp>
27 #include <glibmm/ustring.h>
29 #include <ardour/graph.h>
30 #include <ardour/export_file_io.h>
31 #include <ardour/export_utilities.h>
42 class ExportFormatSpecification;
44 /// Sets up components for export post processing
48 /* Typedefs for utility processors */
50 typedef boost::shared_ptr<SampleRateConverter> SRConverterPtr;
51 typedef boost::shared_ptr<PeakReader> PReaderPtr;
52 typedef boost::shared_ptr<Normalizer> NormalizerPtr;
53 typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
55 typedef GraphSink<float> FloatSink;
56 typedef boost::shared_ptr<FloatSink> FloatSinkPtr;
57 typedef std::vector<FloatSinkPtr> FloatSinkVect;
59 typedef boost::shared_ptr<ExportFilename> FilenamePtr;
60 typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr;
62 typedef boost::shared_ptr<ExportFileWriter> FileWriterPtr;
63 typedef std::list<FileWriterPtr> FileWriterList;
67 ExportProcessor (Session & session);
69 ExportProcessor * copy() { return new ExportProcessor (session); }
71 /// Do preparations for exporting
72 /** Should be called before process
73 * @return 0 on success
75 int prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, bool split = false, nframes_t start = 0);
78 /** @param frames frames to process @return frames written **/
79 nframes_t process (float * data, nframes_t frames);
81 /** should be called after all data is given to process **/
82 void prepare_post_processors ();
86 static sigc::signal<void, Glib::ustring> WritingFile;
93 boost::shared_ptr<ExportStatus> status;
95 /* these are initalized in prepare() */
98 NormalizerPtr normalizer;
100 PReaderPtr peak_reader;
101 TempFilePtr temp_file;
102 FloatSinkVect file_sinks;
103 FileWriterList writer_list;
109 nframes_t frame_rate;
119 nframes_t silence_beginning;
120 nframes_t silence_end;
124 nframes_t temp_file_position;
125 nframes_t temp_file_length;
128 } // namespace ARDOUR
130 #endif /* __ardour_export_processor_h__ */