summaryrefslogtreecommitdiff
path: root/libs/ardour/export_graph_builder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/export_graph_builder.cc')
-rw-r--r--libs/ardour/export_graph_builder.cc34
1 files changed, 25 insertions, 9 deletions
diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc
index 5b5ec16b36..3b1d1e3838 100644
--- a/libs/ardour/export_graph_builder.cc
+++ b/libs/ardour/export_graph_builder.cc
@@ -56,11 +56,26 @@ ExportGraphBuilder::process (nframes_t frames, bool last_cycle)
return 0;
}
+bool
+ExportGraphBuilder::process_normalize ()
+{
+ for (std::list<Normalizer *>::iterator it = normalizers.begin(); it != normalizers.end(); /* ++ in loop */) {
+ if ((*it)->process()) {
+ it = normalizers.erase (it);
+ } else {
+ ++it;
+ }
+ }
+
+ return normalizers.empty();
+}
+
void
ExportGraphBuilder::reset ()
{
channel_configs.clear ();
channels.clear ();
+ normalizers.clear ();
}
void
@@ -252,20 +267,21 @@ ExportGraphBuilder::Normalizer::operator== (FileSpec const & other_config) const
config.format->normalize_target() == other_config.format->normalize_target();
}
-void
-ExportGraphBuilder::Normalizer::start_post_processing()
+bool
+ExportGraphBuilder::Normalizer::process()
{
- normalizer->set_peak (peak_reader->get_peak());
- tmp_file->seek (0, SndfileReader<Sample>::SeekBeginning);
- parent.thread_pool.push (sigc::mem_fun (*this, &Normalizer::do_post_processing));
+ ProcessContext<Sample> buffer_copy (*buffer);
+ tmp_file->read (buffer_copy);
+ normalizer->process (buffer_copy);
+ return buffer_copy.frames() != buffer->frames();
}
void
-ExportGraphBuilder::Normalizer::do_post_processing()
+ExportGraphBuilder::Normalizer::start_post_processing()
{
- while (tmp_file->read (*buffer) == buffer->frames()) {
- normalizer->process (*buffer);
- }
+ normalizer->set_peak (peak_reader->get_peak());
+ tmp_file->seek (0, SndfileReader<Sample>::SeekBeginning);
+ parent.normalizers.push_back (this);
}
/* SRC */