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
This commit is contained in:
parent
c5f67d62df
commit
1de3eac2de
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user