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;
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);
#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 ();
/* 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;
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();
/* 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);
}
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 */
{
if (graph_builder->process_normalize ()) {
finish_timespan ();
+ export_status->normalizing = false;
+ } else {
+ export_status->normalizing = true;
}
return 0;
_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