mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
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
5 changed files with 25 additions and 42 deletions
|
|
@ -328,26 +328,15 @@ ExportDialog::show_progress ()
|
||||||
gint
|
gint
|
||||||
ExportDialog::progress_timeout ()
|
ExportDialog::progress_timeout ()
|
||||||
{
|
{
|
||||||
switch (status->stage) {
|
std::string status_text;
|
||||||
case export_None:
|
if (status->normalizing) {
|
||||||
progress_label.set_text ("");
|
status_text = string_compose (_("Normalizing timespan %1 of %2"),
|
||||||
break;
|
status->timespan, status->total_timespans);
|
||||||
case export_ReadTimespan:
|
} else {
|
||||||
progress_label.set_text (string_compose (_("Reading timespan %1 of %2"), status->timespan, status->total_timespans));
|
status_text = string_compose (_("Exporting timespan %1 of %2"),
|
||||||
break;
|
status->timespan, status->total_timespans);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
progress_label.set_text (status_text);
|
||||||
|
|
||||||
progress_bar.set_fraction (status->progress);
|
progress_bar.set_fraction (status->progress);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ class ExportGraphBuilder
|
||||||
|
|
||||||
int process (framecnt_t frames, bool last_cycle);
|
int process (framecnt_t frames, bool last_cycle);
|
||||||
bool process_normalize (); // returns true when finished
|
bool process_normalize (); // returns true when finished
|
||||||
|
bool will_normalize() { return !normalizers.empty(); }
|
||||||
|
|
||||||
void reset ();
|
void reset ();
|
||||||
void set_current_timespan (boost::shared_ptr<ExportTimespan> span);
|
void set_current_timespan (boost::shared_ptr<ExportTimespan> span);
|
||||||
|
|
|
||||||
|
|
@ -22,20 +22,15 @@
|
||||||
#define __ardour_export_status_h__
|
#define __ardour_export_status_h__
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "pbd/signals.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "ardour/types.h"
|
||||||
|
|
||||||
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
namespace ARDOUR
|
namespace ARDOUR
|
||||||
{
|
{
|
||||||
|
|
||||||
enum ExportStage {
|
|
||||||
export_None,
|
|
||||||
export_ReadTimespan,
|
|
||||||
export_PostProcess,
|
|
||||||
export_Write
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ExportStatus {
|
struct ExportStatus {
|
||||||
|
|
||||||
ExportStatus ();
|
ExportStatus ();
|
||||||
|
|
@ -57,17 +52,14 @@ struct ExportStatus {
|
||||||
|
|
||||||
/* Progress info */
|
/* Progress info */
|
||||||
|
|
||||||
volatile ExportStage stage;
|
|
||||||
volatile float progress;
|
volatile float progress;
|
||||||
|
volatile bool normalizing;
|
||||||
|
|
||||||
volatile uint32_t total_timespans;
|
volatile uint32_t total_timespans;
|
||||||
volatile uint32_t timespan;
|
volatile uint32_t timespan;
|
||||||
|
|
||||||
volatile uint32_t total_channel_configs;
|
volatile framecnt_t total_frames;
|
||||||
volatile uint32_t channel_config;
|
volatile framecnt_t processed_frames;
|
||||||
|
|
||||||
volatile uint32_t total_formats;
|
|
||||||
volatile uint32_t format;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
volatile bool _aborted;
|
volatile bool _aborted;
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@ ExportHandler::do_export (bool rt)
|
||||||
std::set<ExportTimespanPtr> timespan_set;
|
std::set<ExportTimespanPtr> timespan_set;
|
||||||
for (ConfigMap::iterator it = config_map.begin(); it != config_map.end(); ++it) {
|
for (ConfigMap::iterator it = config_map.begin(); it != config_map.end(); ++it) {
|
||||||
timespan_set.insert (it->first);
|
timespan_set.insert (it->first);
|
||||||
|
export_status->total_frames += it->first->get_length();
|
||||||
}
|
}
|
||||||
export_status->total_timespans = timespan_set.size();
|
export_status->total_timespans = timespan_set.size();
|
||||||
|
|
||||||
|
|
@ -198,7 +199,6 @@ ExportHandler::process_timespan (framecnt_t frames)
|
||||||
/* update position */
|
/* update position */
|
||||||
|
|
||||||
framecnt_t frames_to_read = 0;
|
framecnt_t frames_to_read = 0;
|
||||||
framepos_t const start = current_timespan->get_start();
|
|
||||||
framepos_t const end = current_timespan->get_end();
|
framepos_t const end = current_timespan->get_end();
|
||||||
|
|
||||||
bool const last_cycle = (process_position + frames >= end);
|
bool const last_cycle = (process_position + frames >= end);
|
||||||
|
|
@ -212,7 +212,8 @@ ExportHandler::process_timespan (framecnt_t frames)
|
||||||
}
|
}
|
||||||
|
|
||||||
process_position += frames_to_read;
|
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 */
|
/* Do actual processing */
|
||||||
|
|
||||||
|
|
@ -224,6 +225,9 @@ ExportHandler::process_normalize ()
|
||||||
{
|
{
|
||||||
if (graph_builder->process_normalize ()) {
|
if (graph_builder->process_normalize ()) {
|
||||||
finish_timespan ();
|
finish_timespan ();
|
||||||
|
export_status->normalizing = false;
|
||||||
|
} else {
|
||||||
|
export_status->normalizing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -37,17 +37,14 @@ ExportStatus::init ()
|
||||||
_finished = false;
|
_finished = false;
|
||||||
_errors = false;
|
_errors = false;
|
||||||
|
|
||||||
stage = export_None;
|
|
||||||
progress = 0.0;
|
progress = 0.0;
|
||||||
|
normalizing = false;
|
||||||
|
|
||||||
total_timespans = 0;
|
total_timespans = 0;
|
||||||
timespan = 0;
|
timespan = 0;
|
||||||
|
|
||||||
total_channel_configs = 0;
|
total_frames = 0;
|
||||||
channel_config = 0;
|
processed_frames = 0;
|
||||||
|
|
||||||
total_formats = 0;
|
|
||||||
format = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue