From a664fb703e2cc30196231f2614178e834fe804ba Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 16 Feb 2016 14:25:49 +0100 Subject: chunk data before analysis, prefer 8K * consistent spectrum display for all reports (same binsize) * improved performance (power of two) --- libs/ardour/ardour/export_graph_builder.h | 2 ++ libs/ardour/export_graph_builder.cc | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index f2fbbb63fa..0a9912e43e 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -127,6 +127,7 @@ class LIBARDOUR_API ExportGraphBuilder void set_peak (float); private: + typedef boost::shared_ptr > ChunkerPtr; typedef boost::shared_ptr > FloatConverterPtr; typedef boost::shared_ptr > IntConverterPtr; typedef boost::shared_ptr > ShortConverterPtr; @@ -135,6 +136,7 @@ class LIBARDOUR_API ExportGraphBuilder boost::ptr_list children; int data_width; + ChunkerPtr chunker; AnalysisPtr analyser; bool _analyse; // Only one of these should be available at a time diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index 9e25d51513..58eecff899 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -311,8 +311,11 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c framecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate); framecnt_t se = config.format->silence_end_at (parent.timespan->get_end(), sample_rate); framecnt_t duration = parent.timespan->get_length () + sb + se; + max_frames = min ((framecnt_t) 8192 * channels, max ((framecnt_t) 4096 * channels, max_frames)); + chunker.reset (new Chunker (max_frames)); analyser.reset (new Analyser (config.format->sample_rate(), channels, max_frames, (framecnt_t) ceil (duration * config.format->sample_rate () / sample_rate))); + chunker->add_output (analyser); parent.add_analyser (config.filename->get_path (config.format), analyser); } @@ -348,7 +351,7 @@ ExportGraphBuilder::FloatSinkPtr ExportGraphBuilder::SFC::sink () { if (_analyse) { - return analyser; + return chunker; } else if (data_width == 8 || data_width == 16) { return short_converter; } else if (data_width == 24 || data_width == 32) { -- cgit v1.2.3