From 6b50ba341da426805ce3c92609c0fa12c52b67ac Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Sun, 28 Sep 2008 11:11:38 +0000 Subject: * Improved export error handling, streamlined ExportFailed * Cleaned out export related visibility in Session, and simpified Session <--> export component communication in general * Removed export_status.h header dependency from session.h * Added check for libsndfile FLAC and Ogg Vorbis compatibility * Added ExportFileFactory, leading in cleaner code in ExportProcessor, and better extensibility for possible future non-libsndfile formats git-svn-id: svn://localhost/ardour2/branches/3.0@3818 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/export_channel_configuration.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'libs/ardour/export_channel_configuration.cc') diff --git a/libs/ardour/export_channel_configuration.cc b/libs/ardour/export_channel_configuration.cc index 97b05c2f1e..e6eb84be06 100644 --- a/libs/ardour/export_channel_configuration.cc +++ b/libs/ardour/export_channel_configuration.cc @@ -57,10 +57,10 @@ ExportChannel::read_ports (float * data, nframes_t frames) const /* ExportChannelConfiguration */ -ExportChannelConfiguration::ExportChannelConfiguration (ExportStatus & status, Session & session) : +ExportChannelConfiguration::ExportChannelConfiguration (Session & session) : session (session), writer_thread (*this), - status (status), + status (session.get_export_status ()), files_written (false), split (false) { @@ -143,7 +143,7 @@ ExportChannelConfiguration::write_files (boost::shared_ptr new_ files_written = true; if (!timespan) { - throw ExportFailed (_("Export failed due to a programming error"), _("No timespan registered to channel configuration when requesting files to be written")); + throw ExportFailed (X_("Programming error: No timespan registered to channel configuration when requesting files to be written")); } /* Take a local copy of the processor to be used in the thread that is created below */ @@ -175,7 +175,7 @@ ExportChannelConfiguration::write_file () uint32_t channel; do { - if (status.aborted()) { break; } + if (status->aborted()) { break; } channel = 0; for (ChannelList::iterator it = channels.begin(); it != channels.end(); ++it) { @@ -194,7 +194,7 @@ ExportChannelConfiguration::write_file () } progress += frames_read; - status.progress = (float) progress / timespan_length; + status->progress = (float) progress / timespan_length; } while (processor->process (file_buffer, frames_read) > 0); @@ -211,14 +211,18 @@ ExportChannelConfiguration::_write_files (void *arg) // cc can be trated like 'this' WriterThread & cc (*((WriterThread *) arg)); - for (FileConfigList::iterator it = cc->file_configs.begin(); it != cc->file_configs.end(); ++it) { - if (cc->status.aborted()) { - break; + try { + for (FileConfigList::iterator it = cc->file_configs.begin(); it != cc->file_configs.end(); ++it) { + if (cc->status->aborted()) { + break; + } + cc->processor->prepare (it->first, it->second, cc->channels.size(), cc->split, cc->timespan->get_start()); + cc->write_file (); // Writes tempfile + cc->processor->prepare_post_processors (); + cc->processor->write_files(); } - cc->processor->prepare (it->first, it->second, cc->channels.size(), cc->split, cc->timespan->get_start()); - cc->write_file (); // Writes tempfile - cc->processor->prepare_post_processors (); - cc->processor->write_files(); + } catch (ExportFailed & e) { + cc->status->abort (true); } cc.running = false; -- cgit v1.2.3