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"
39 class ExportFormatSpecification;
41 /// Sets up components for export post processing
45 /* Typedefs for utility processors */
47 typedef boost::shared_ptr<SampleRateConverter> SRConverterPtr;
48 typedef boost::shared_ptr<PeakReader> PReaderPtr;
49 typedef boost::shared_ptr<Normalizer> NormalizerPtr;
50 typedef boost::shared_ptr<ExportTempFile> TempFilePtr;
52 typedef GraphSink<float> FloatSink;
53 typedef boost::shared_ptr<FloatSink> FloatSinkPtr;
54 typedef std::vector<FloatSinkPtr> FloatSinkVect;
56 typedef boost::shared_ptr<ExportFilename> FilenamePtr;
57 typedef boost::shared_ptr<ExportFormatSpecification const> FormatPtr;
59 typedef boost::shared_ptr<ExportFileWriter> FileWriterPtr;
60 typedef std::list<FileWriterPtr> FileWriterList;
64 ExportProcessor (Session & session);
66 ExportProcessor * copy() { return new ExportProcessor (session); }
68 /// Do preparations for exporting
69 /** Should be called before process
70 * @return 0 on success
72 int prepare (FormatPtr format, FilenamePtr fname, uint32_t chans, bool split = false, nframes_t start = 0);
75 /** @param frames frames to process @return frames written **/
76 nframes_t process (float * data, nframes_t frames);
78 /** should be called after all data is given to process **/
79 void prepare_post_processors ();
83 static sigc::signal<void, Glib::ustring> WritingFile;
90 boost::shared_ptr<ExportStatus> status;
92 /* these are initalized in prepare() */
95 NormalizerPtr normalizer;
97 PReaderPtr peak_reader;
98 TempFilePtr temp_file;
99 FloatSinkVect file_sinks;
100 FileWriterList writer_list;
106 nframes_t frame_rate;
116 nframes_t silence_beginning;
117 nframes_t silence_end;
121 nframes_t temp_file_position;
122 nframes_t temp_file_length;
125 } // namespace ARDOUR
127 #endif /* __ardour_export_processor_h__ */