summaryrefslogtreecommitdiff
path: root/libs/ardour/export_graph_builder.cc
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2012-01-24 20:21:54 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2012-01-24 20:21:54 +0000
commitf57da9b00e0660640c7a4cbb48f32ef63830d463 (patch)
tree49a1e3dff9e3d3fb525b9baaff9514dc45c34c98 /libs/ardour/export_graph_builder.cc
parente6a7a679339bf71719775da7b6111cd4857bd6f0 (diff)
Show proper progress information for export while normalizing
git-svn-id: svn://localhost/ardour2/branches/3.0@11337 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_graph_builder.cc')
-rw-r--r--libs/ardour/export_graph_builder.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc
index f01b5e0904..9b35e16530 100644
--- a/libs/ardour/export_graph_builder.cc
+++ b/libs/ardour/export_graph_builder.cc
@@ -68,6 +68,16 @@ ExportGraphBuilder::process_normalize ()
return normalizers.empty();
}
+unsigned
+ExportGraphBuilder::get_normalize_cycle_count() const
+{
+ unsigned max = 0;
+ for (std::list<Normalizer *>::const_iterator it = normalizers.begin(); it != normalizers.end(); ++it) {
+ max = std::max(max, (*it)->get_normalize_cycle_count());
+ }
+ return max;
+}
+
void
ExportGraphBuilder::reset ()
{
@@ -296,7 +306,8 @@ ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpe
int format = ExportFormatBase::F_RAW | ExportFormatBase::SF_Float;
tmp_file.reset (new TmpFile<float> (format, config.channel_config->get_n_chans(),
config.format->sample_rate()));
- tmp_file->FileWritten.connect_same_thread (post_processing_connection, boost::bind (&Normalizer::start_post_processing, this));
+ tmp_file->FileWritten.connect_same_thread (post_processing_connection,
+ boost::bind (&Normalizer::start_post_processing, this));
add_child (new_config);
@@ -330,6 +341,13 @@ ExportGraphBuilder::Normalizer::operator== (FileSpec const & other_config) const
config.format->normalize_target() == other_config.format->normalize_target();
}
+unsigned
+ExportGraphBuilder::Normalizer::get_normalize_cycle_count() const
+{
+ return static_cast<unsigned>(std::ceil(static_cast<float>(tmp_file->get_frames_written()) /
+ max_frames_out));
+}
+
bool
ExportGraphBuilder::Normalizer::process()
{