X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fexport_graph_builder.h;h=b692b03b3231f2e09b91ee1cabfce48e562f9870;hb=faefc3ba9a42417b133235e0a9efeaba467aad5f;hp=b4ef0a1d94a6f95d5bb16169485fcfd030b9ba90;hpb=1de3eac2deeb5400e349114ff59d6fa0a6d6de1e;p=ardour.git diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index b4ef0a1d94..b692b03b32 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -21,10 +21,8 @@ #ifndef __ardour_export_graph_builder_h__ #define __ardour_export_graph_builder_h__ -#include "ardour/ardour.h" #include "ardour/export_handler.h" -#include "ardour/export_channel.h" -#include "ardour/export_format_base.h" +#include "ardour/export_analysis.h" #include "audiographer/utils/identity_vertex.h" @@ -34,7 +32,10 @@ namespace AudioGrapher { class SampleRateConverter; class PeakReader; + class LoudnessReader; class Normalizer; + class Analyser; + template class Chunker; template class SampleFormatConverter; template class Interleaver; template class SndfileWriter; @@ -47,14 +48,19 @@ namespace AudioGrapher { namespace ARDOUR { -class ExportGraphBuilder +class ExportTimespan; +class Session; + +class LIBARDOUR_API ExportGraphBuilder { private: typedef ExportHandler::FileSpec FileSpec; typedef boost::shared_ptr > FloatSinkPtr; typedef boost::shared_ptr > IdentityVertexPtr; + typedef boost::shared_ptr AnalysisPtr; typedef std::map ChannelMap; + typedef std::map AnalysisMap; public: @@ -63,25 +69,35 @@ class ExportGraphBuilder int process (framecnt_t frames, bool last_cycle); bool process_normalize (); // returns true when finished - bool will_normalize() { return !normalizers.empty(); } + bool will_normalize() const { return !normalizers.empty(); } + bool realtime() const { return _realtime; } + unsigned get_normalize_cycle_count() const; void reset (); + void cleanup (bool remove_out_files = false); void set_current_timespan (boost::shared_ptr span); - void add_config (FileSpec const & config); + void add_config (FileSpec const & config, bool rt); + void get_analysis_results (AnalysisResults& results); private: + void add_analyser (const std::string& fn, AnalysisPtr ap) { + analysis_map.insert (std::make_pair (fn, ap)); + } + void add_split_config (FileSpec const & config); class Encoder { - public: + public: template boost::shared_ptr > init (FileSpec const & new_config); void add_child (FileSpec const & new_config); + void remove_children (); + void destroy_writer (bool delete_out_file); bool operator== (FileSpec const & other_config) const; static int get_real_format (FileSpec const & config); - private: + private: typedef boost::shared_ptr > FloatWriterPtr; typedef boost::shared_ptr > IntWriterPtr; typedef boost::shared_ptr > ShortWriterPtr; @@ -93,6 +109,8 @@ class ExportGraphBuilder std::list filenames; PBD::ScopedConnection copy_files_connection; + std::string writer_filename; + // Only one of these should be available at a time FloatWriterPtr float_writer; IntWriterPtr int_writer; @@ -101,14 +119,17 @@ class ExportGraphBuilder // sample format converter class SFC { - public: + public: // This constructor so that this can be constructed like a Normalizer SFC (ExportGraphBuilder &, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; + void set_peak (float); - private: + private: + typedef boost::shared_ptr > ChunkerPtr; typedef boost::shared_ptr > FloatConverterPtr; typedef boost::shared_ptr > IntConverterPtr; typedef boost::shared_ptr > ShortConverterPtr; @@ -117,6 +138,9 @@ class ExportGraphBuilder boost::ptr_list children; int data_width; + ChunkerPtr chunker; + AnalysisPtr analyser; + bool _analyse; // Only one of these should be available at a time FloatConverterPtr float_converter; IntConverterPtr int_converter; @@ -124,48 +148,57 @@ class ExportGraphBuilder }; class Normalizer { - public: + public: Normalizer (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; + unsigned get_normalize_cycle_count() const; + /// Returns true when finished bool process (); - private: + private: typedef boost::shared_ptr PeakReaderPtr; + typedef boost::shared_ptr LoudnessReaderPtr; typedef boost::shared_ptr NormalizerPtr; typedef boost::shared_ptr > TmpFilePtr; typedef boost::shared_ptr > ThreaderPtr; typedef boost::shared_ptr > BufferPtr; - void start_post_processing(); + void prepare_post_processing (); + void start_post_processing (); ExportGraphBuilder & parent; FileSpec config; framecnt_t max_frames_out; - + bool use_loudness; + bool use_peak; BufferPtr buffer; PeakReaderPtr peak_reader; TmpFilePtr tmp_file; NormalizerPtr normalizer; ThreaderPtr threader; + LoudnessReaderPtr loudness_reader; boost::ptr_list children; - PBD::ScopedConnection post_processing_connection; + PBD::ScopedConnectionList post_processing_connection; }; // sample rate converter class SRC { - public: + public: SRC (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); + bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr SRConverterPtr; template @@ -181,13 +214,14 @@ class ExportGraphBuilder // Silence trimmer + adder class SilenceHandler { - public: + public: SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr > SilenceTrimmerPtr; ExportGraphBuilder & parent; @@ -199,19 +233,22 @@ class ExportGraphBuilder // channel configuration class ChannelConfig { - public: + public: ChannelConfig (ExportGraphBuilder & parent, FileSpec const & new_config, ChannelMap & channel_map); void add_child (FileSpec const & new_config); + void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; - private: + private: typedef boost::shared_ptr > InterleaverPtr; + typedef boost::shared_ptr > ChunkerPtr; ExportGraphBuilder & parent; FileSpec config; boost::ptr_list children; InterleaverPtr interleaver; - framecnt_t max_frames; + ChunkerPtr chunker; + framecnt_t max_frames_out; }; Session const & session; @@ -228,6 +265,10 @@ class ExportGraphBuilder std::list normalizers; + AnalysisMap analysis_map; + + bool _realtime; + Glib::ThreadPool thread_pool; };