summaryrefslogtreecommitdiff
path: root/libs/ardour/export_handler.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_handler.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_handler.cc')
-rw-r--r--libs/ardour/export_handler.cc29
1 files changed, 24 insertions, 5 deletions
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc
index 305df0d28a..42d5c8901c 100644
--- a/libs/ardour/export_handler.cc
+++ b/libs/ardour/export_handler.cc
@@ -138,8 +138,10 @@ ExportHandler::do_export (bool rt)
export_status->init();
std::set<ExportTimespanPtr> timespan_set;
for (ConfigMap::iterator it = config_map.begin(); it != config_map.end(); ++it) {
- timespan_set.insert (it->first);
- export_status->total_frames += it->first->get_length();
+ bool new_timespan = timespan_set.insert (it->first).second;
+ if (new_timespan) {
+ export_status->total_frames += it->first->get_length();
+ }
}
export_status->total_timespans = timespan_set.size();
@@ -207,18 +209,31 @@ ExportHandler::process_timespan (framecnt_t frames)
if (last_cycle) {
frames_to_read = end - process_position;
export_status->stop = true;
- normalizing = true;
} else {
frames_to_read = frames;
}
process_position += frames_to_read;
export_status->processed_frames += frames_to_read;
- export_status->progress = (float) export_status->processed_frames / export_status->total_frames;
+ export_status->progress = (float) export_status->processed_frames /
+ export_status->total_frames;
/* Do actual processing */
+ int ret = graph_builder->process (frames_to_read, last_cycle);
- return graph_builder->process (frames_to_read, last_cycle);
+ /* Start normalizing if necessary */
+ if (last_cycle) {
+ normalizing = graph_builder->will_normalize();
+ if (normalizing) {
+ export_status->total_normalize_cycles = graph_builder->get_normalize_cycle_count();
+ export_status->current_normalize_cycle = 0;
+ } else {
+ finish_timespan ();
+ return 0;
+ }
+ }
+
+ return ret;
}
int
@@ -231,6 +246,10 @@ ExportHandler::process_normalize ()
export_status->normalizing = true;
}
+ export_status->progress = (float) export_status->current_normalize_cycle /
+ export_status->total_normalize_cycles;
+ export_status->current_normalize_cycle++;
+
return 0;
}