Show proper progress information for export while normalizing

git-svn-id: svn://localhost/ardour2/branches/3.0@11337 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sakari Bergen 2012-01-24 20:21:54 +00:00
parent e6a7a67933
commit f57da9b00e
5 changed files with 69 additions and 9 deletions

View file

@ -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()
{