diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2011-06-11 21:12:24 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2011-06-11 21:12:24 +0000 |
commit | 1de3eac2deeb5400e349114ff59d6fa0a6d6de1e (patch) | |
tree | b9ab48878dad4e5bbce0f3d177b36b14db84357d | |
parent | c5f67d62dff570c208f55c58d6cd96e8af86b852 (diff) |
Fix #4094: show total export progress instead of per timespan progress
git-svn-id: svn://localhost/ardour2/branches/3.0@9710 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/export_dialog.cc | 27 | ||||
-rw-r--r-- | libs/ardour/ardour/export_graph_builder.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/export_status.h | 22 | ||||
-rw-r--r-- | libs/ardour/export_handler.cc | 8 | ||||
-rw-r--r-- | libs/ardour/export_status.cc | 9 |
5 files changed, 25 insertions, 42 deletions
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index e51f5771d3..50796f2fcc 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -328,26 +328,15 @@ ExportDialog::show_progress () gint ExportDialog::progress_timeout () { - switch (status->stage) { - case export_None: - progress_label.set_text (""); - break; - case export_ReadTimespan: - progress_label.set_text (string_compose (_("Reading timespan %1 of %2"), status->timespan, status->total_timespans)); - break; - case export_PostProcess: - progress_label.set_text (string_compose (_("Processing file %2 of %3 (%1) from timespan %4 of %5"), - file_notebook->get_nth_format_name (status->format), - status->format, status->total_formats, - status->timespan, status->total_timespans)); - break; - case export_Write: - progress_label.set_text (string_compose (_("Encoding file %2 of %3 (%1) from timespan %4 of %5"), - file_notebook->get_nth_format_name (status->format), - status->format, status->total_formats, - status->timespan, status->total_timespans)); - break; + std::string status_text; + if (status->normalizing) { + status_text = string_compose (_("Normalizing timespan %1 of %2"), + status->timespan, status->total_timespans); + } else { + status_text = string_compose (_("Exporting timespan %1 of %2"), + status->timespan, status->total_timespans); } + progress_label.set_text (status_text); progress_bar.set_fraction (status->progress); return TRUE; diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index bce6838d02..b4ef0a1d94 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -63,6 +63,7 @@ class ExportGraphBuilder int process (framecnt_t frames, bool last_cycle); bool process_normalize (); // returns true when finished + bool will_normalize() { return !normalizers.empty(); } void reset (); void set_current_timespan (boost::shared_ptr<ExportTimespan> span); diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 1613fffe52..a42327c8aa 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -22,20 +22,15 @@ #define __ardour_export_status_h__ #include <list> -#include "pbd/signals.h" - #include <stdint.h> +#include "ardour/types.h" + +#include "pbd/signals.h" + namespace ARDOUR { -enum ExportStage { - export_None, - export_ReadTimespan, - export_PostProcess, - export_Write -}; - struct ExportStatus { ExportStatus (); @@ -57,17 +52,14 @@ struct ExportStatus { /* Progress info */ - volatile ExportStage stage; volatile float progress; + volatile bool normalizing; volatile uint32_t total_timespans; volatile uint32_t timespan; - volatile uint32_t total_channel_configs; - volatile uint32_t channel_config; - - volatile uint32_t total_formats; - volatile uint32_t format; + volatile framecnt_t total_frames; + volatile framecnt_t processed_frames; private: volatile bool _aborted; diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 9279c73266..f34e8c326b 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -138,6 +138,7 @@ ExportHandler::do_export (bool rt) 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(); } export_status->total_timespans = timespan_set.size(); @@ -198,7 +199,6 @@ ExportHandler::process_timespan (framecnt_t frames) /* update position */ framecnt_t frames_to_read = 0; - framepos_t const start = current_timespan->get_start(); framepos_t const end = current_timespan->get_end(); bool const last_cycle = (process_position + frames >= end); @@ -212,7 +212,8 @@ ExportHandler::process_timespan (framecnt_t frames) } process_position += frames_to_read; - export_status->progress = (float) (process_position - start) / (end - start); + export_status->processed_frames += frames_to_read; + export_status->progress = (float) export_status->processed_frames / export_status->total_frames; /* Do actual processing */ @@ -224,6 +225,9 @@ ExportHandler::process_normalize () { if (graph_builder->process_normalize ()) { finish_timespan (); + export_status->normalizing = false; + } else { + export_status->normalizing = true; } return 0; diff --git a/libs/ardour/export_status.cc b/libs/ardour/export_status.cc index eb0a3504b4..dbb96432ee 100644 --- a/libs/ardour/export_status.cc +++ b/libs/ardour/export_status.cc @@ -37,17 +37,14 @@ ExportStatus::init () _finished = false; _errors = false; - stage = export_None; progress = 0.0; + normalizing = false; total_timespans = 0; timespan = 0; - total_channel_configs = 0; - channel_config = 0; - - total_formats = 0; - format = 0; + total_frames = 0; + processed_frames = 0; } void |