mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 15:16:25 +01:00
[Summary] Progressing Tracks specific export dialog.
This commit is contained in:
parent
360692e838
commit
0729ff3f8e
5 changed files with 156 additions and 17 deletions
|
|
@ -45,6 +45,7 @@
|
|||
#include "audio_region_view.h"
|
||||
#include "audio_time_axis.h"
|
||||
#include "editor.h"
|
||||
#include "waves_export_dialog.h"
|
||||
#include "export_dialog.h"
|
||||
#include "midi_export_dialog.h"
|
||||
#include "midi_region_view.h"
|
||||
|
|
@ -63,6 +64,10 @@ using namespace Gtk;
|
|||
void
|
||||
Editor::export_audio ()
|
||||
{
|
||||
{
|
||||
WavesExportDialog export_dialog (_("Export"), _session, ExportProfileManager::RegularExport);
|
||||
export_dialog.run();
|
||||
}
|
||||
ExportDialog dialog (*this, _("Export"), ExportProfileManager::RegularExport);
|
||||
dialog.set_session (_session);
|
||||
dialog.run();
|
||||
|
|
|
|||
|
|
@ -18,11 +18,16 @@
|
|||
*/
|
||||
|
||||
#include "waves_export_dialog.h"
|
||||
WavesExportDialog::WavesExportDialog (const std::string &title, ARDOUR::ExportProfileManager::ExportType type)
|
||||
|
||||
WavesExportDialog::WavesExportDialog (const std::string &title, ARDOUR::Session* session, ARDOUR::ExportProfileManager::ExportType type)
|
||||
: WavesDialog ("waves_export_dialog.xml", true, false )
|
||||
, _export_button (get_waves_button ("export_button"))
|
||||
, _cancel_button (get_waves_button ("cancel_button"))
|
||||
, _stop_export_button (get_waves_button ("stop_export_button"))
|
||||
, _export_progress_bar (get_progressbar ("export_progress_bar"))
|
||||
, _export_type (type)
|
||||
, _previous_progress (0)
|
||||
{
|
||||
set_title (title);
|
||||
init ();
|
||||
init (session);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,23 +21,19 @@
|
|||
#define __waves_export_dialog_h__
|
||||
|
||||
#include "ardour/export_profile_manager.h"
|
||||
#include "public_editor.h"
|
||||
#include "export_timespan_selector.h"
|
||||
#include "export_channel_selector.h"
|
||||
#include "export_file_notebook.h"
|
||||
#include "export_preset_selector.h"
|
||||
#include "soundcloud_export_selector.h"
|
||||
|
||||
#include "waves_dialog.h"
|
||||
|
||||
class WavesExportDialog : public WavesDialog
|
||||
{
|
||||
public:
|
||||
WavesExportDialog(const std::string &title, ARDOUR::ExportProfileManager::ExportType type);
|
||||
WavesExportDialog(const std::string &title, ARDOUR::Session* session, ARDOUR::ExportProfileManager::ExportType type);
|
||||
|
||||
protected:
|
||||
WavesButton& _export_button;
|
||||
WavesButton& _cancel_button;
|
||||
WavesButton& _stop_export_button;
|
||||
Gtk::ProgressBar &_export_progress_bar;
|
||||
|
||||
private:
|
||||
#include "waves_export_dialog.logic.h"
|
||||
|
|
|
|||
|
|
@ -17,23 +17,135 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "ardour/audioregion.h"
|
||||
#include "ardour/export_status.h"
|
||||
#include "ardour/export_handler.h"
|
||||
#include "waves_export_dialog.h"
|
||||
#include "public_editor.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "time_selection.h"
|
||||
#include "i18n.h"
|
||||
|
||||
void
|
||||
WavesExportDialog::init ()
|
||||
WavesExportDialog::init (ARDOUR::Session* session)
|
||||
{
|
||||
_export_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportDialog::_on_export_button_clicked));
|
||||
_cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportDialog::_on_export_button_clicked));
|
||||
_cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesExportDialog::_on_cancel_button_clicked));
|
||||
|
||||
SessionHandlePtr::set_session (session);
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
/* Init handler and profile manager */
|
||||
_export_handler = _session->get_export_handler ();
|
||||
_export_status = _session->get_export_status ();
|
||||
|
||||
_profile_manager.reset (new ARDOUR::ExportProfileManager (*_session, _export_type));
|
||||
|
||||
TimeSelection const & time (ARDOUR_UI::instance()->the_editor ().get_selection().time);
|
||||
if (!time.empty()) {
|
||||
_profile_manager->set_selection_range (time.front().start, time.front().end);
|
||||
} else {
|
||||
_profile_manager->set_selection_range ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WavesExportDialog::_show_progress ()
|
||||
{
|
||||
_export_status->running = true;
|
||||
|
||||
_cancel_button.hide ();
|
||||
_stop_export_button.show ();
|
||||
|
||||
_export_progress_bar.set_fraction (0.0);
|
||||
_export_progress_bar.show ();
|
||||
_progress_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &WavesExportDialog::_on_progress_timeout), 100);
|
||||
|
||||
gtk_main_iteration ();
|
||||
|
||||
while (_export_status->running) {
|
||||
if (gtk_events_pending()) {
|
||||
gtk_main_iteration ();
|
||||
} else {
|
||||
Glib::usleep (10000);
|
||||
}
|
||||
}
|
||||
|
||||
if (_export_status->aborted()) {
|
||||
_notify_errors ();
|
||||
}
|
||||
|
||||
_export_status->finish ();
|
||||
}
|
||||
|
||||
void
|
||||
WavesExportDialog::_notify_errors (bool force)
|
||||
{
|
||||
if (force || _export_status->errors()) {
|
||||
std::string txt = _("Export has been aborted due to an error!\nSee the Log for details.");
|
||||
WavesMessageDialog msg ("", txt);
|
||||
msg.run();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WavesExportDialog::_on_export_button_clicked (WavesButton*)
|
||||
{
|
||||
response (Gtk::RESPONSE_OK);
|
||||
_export_error.clear ();
|
||||
_previous_progress = 0;
|
||||
try {
|
||||
_profile_manager->prepare_for_export ();
|
||||
_export_handler->soundcloud_make_public = false;
|
||||
_export_handler->soundcloud_open_page = false;
|
||||
_export_handler->soundcloud_downloadable = false;
|
||||
|
||||
_export_handler->do_export ();
|
||||
_show_progress ();
|
||||
} catch(std::exception & e) {
|
||||
_export_error << string_compose (_("Export initialization failed: %1"), e.what()) << endmsg;
|
||||
_notify_errors(true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WavesExportDialog::_on_cancel_button_clicked (WavesButton*)
|
||||
{
|
||||
if (_export_status->running) {
|
||||
_export_status->abort();
|
||||
}
|
||||
|
||||
hide ();
|
||||
set_modal (false);
|
||||
response (Gtk::RESPONSE_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
WavesExportDialog::_on_progress_timeout ()
|
||||
{
|
||||
std::string status_text;
|
||||
float progress = 0.0;
|
||||
|
||||
if (_export_status->normalizing) {
|
||||
status_text = string_compose (_("Normalizing '%3' (timespan %1 of %2)"),
|
||||
_export_status->timespan, _export_status->total_timespans, _export_status->timespan_name);
|
||||
progress = ((float) _export_status->current_normalize_cycle) / _export_status->total_normalize_cycles;
|
||||
} else {
|
||||
status_text = string_compose (_("Exporting '%3' (timespan %1 of %2)"),
|
||||
_export_status->timespan, _export_status->total_timespans, _export_status->timespan_name);
|
||||
progress = ((float) _export_status->processed_frames_current_timespan) / _export_status->total_frames_current_timespan;
|
||||
}
|
||||
|
||||
_export_progress_bar.set_text (status_text);
|
||||
|
||||
if (progress < _previous_progress) {
|
||||
// Work around gtk bug
|
||||
_export_progress_bar.hide();
|
||||
_export_progress_bar.show();
|
||||
}
|
||||
|
||||
_previous_progress = progress;
|
||||
|
||||
_export_progress_bar.set_fraction (progress);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,29 @@
|
|||
|
||||
//class WavesExportDialog : public WavesDialog
|
||||
//{
|
||||
private:
|
||||
void init ();
|
||||
void _on_export_button_clicked (WavesButton*);
|
||||
void _on_cancel_button_clicked (WavesButton*);
|
||||
protected:
|
||||
|
||||
typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
|
||||
HandlerPtr _export_handler;
|
||||
|
||||
typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
|
||||
ManagerPtr _profile_manager;
|
||||
|
||||
typedef boost::shared_ptr<ARDOUR::ExportStatus> StatusPtr;
|
||||
StatusPtr _export_status;
|
||||
|
||||
ARDOUR::ExportProfileManager::ExportType _export_type;
|
||||
sigc::connection _progress_connection;
|
||||
std::stringstream _export_error;
|
||||
float _previous_progress; // Needed for gtk bug workaround.
|
||||
|
||||
|
||||
void init (ARDOUR::Session* session);
|
||||
void _show_progress ();
|
||||
void _notify_errors (bool force = false);
|
||||
void _on_export_button_clicked (WavesButton*);
|
||||
void _on_cancel_button_clicked (WavesButton*);
|
||||
gint _on_progress_timeout ();
|
||||
|
||||
|
||||
//};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue