diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-11-21 18:17:36 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-11-21 18:17:36 +0000 |
commit | 5de817c2509b3f8ab35e1aea7292e84ca51037ab (patch) | |
tree | 9b71e78db30db4745b963f3ef94d630d7d8b59ba /libs/ardour | |
parent | 7f66b715397ed5debcf1cc29f47dcc8d917d519a (diff) |
* Clean up (fix?) ExportStatus signal handling
* Fix problem in export dialog error reporting
* Sart implementing audio track importer (nothing very functional yet...)
git-svn-id: svn://localhost/ardour2/branches/3.0@4231 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/SConscript | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/audio_track_importer.h | 64 | ||||
-rw-r--r-- | libs/ardour/ardour/export_status.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 1 | ||||
-rw-r--r-- | libs/ardour/audio_playlist_importer.cc | 2 | ||||
-rw-r--r-- | libs/ardour/audio_track_importer.cc | 152 | ||||
-rw-r--r-- | libs/ardour/export_profile_manager.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_export.cc | 5 |
8 files changed, 223 insertions, 6 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index 162994fc81..68d10a0868 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -39,6 +39,7 @@ audio_playlist.cc audio_playlist_importer.cc audio_port.cc audio_track.cc +audio_track_importer.cc audioanalyser.cc audioengine.cc audiofile_tagger.cc diff --git a/libs/ardour/ardour/audio_track_importer.h b/libs/ardour/ardour/audio_track_importer.h new file mode 100644 index 0000000000..212762ee04 --- /dev/null +++ b/libs/ardour/ardour/audio_track_importer.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2008 Paul Davis + Author: Sakari Bergen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_audio_track_importer_h__ +#define __ardour_audio_track_importer_h__ + +#include <pbd/xml++.h> + +#include <ardour/element_importer.h> +#include <ardour/element_import_handler.h> + +namespace ARDOUR { + + +class AudioTrackImportHandler : public ElementImportHandler +{ + public: + AudioTrackImportHandler (XMLTree const & source, Session & session); + virtual ~AudioTrackImportHandler () {} + virtual string get_info () const; +}; + + +class AudioTrackImporter : public ElementImporter +{ + public: + AudioTrackImporter (XMLTree const & source, Session & session, AudioTrackImportHandler & handler, XMLNode const & node); + + string get_info () const; + bool prepare_move (); + void cancel_move (); + void move (); + + private: + + bool parse_io (XMLNode const & node); + bool parse_processor (XMLNode const & node); + + bool parse_controllable (XMLNode const & node, XMLNode & dest_parent); + + XMLNode xml_track; + +}; + +} // namespace ARDOUR + +#endif diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 42dd3aff4c..42b0b061f0 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -36,7 +36,7 @@ enum ExportStage { export_Write }; -struct ExportStatus { +struct ExportStatus : public sigc::trackable { ExportStatus (); void init (); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index ff2bc9c127..24478f9eb8 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1081,7 +1081,6 @@ class Session : public PBD::StatefulDestructible void finalize_audio_export (); sigc::connection export_freewheel_connection; - sigc::connection export_abort_connection; void prepare_diskstreams (); void commit_diskstreams (nframes_t, bool& session_requires_butler); diff --git a/libs/ardour/audio_playlist_importer.cc b/libs/ardour/audio_playlist_importer.cc index d7b6ea42fc..022bc6fab2 100644 --- a/libs/ardour/audio_playlist_importer.cc +++ b/libs/ardour/audio_playlist_importer.cc @@ -103,7 +103,7 @@ AudioPlaylistImporter::AudioPlaylistImporter (XMLTree const & source, Session & // All ok } else if (!prop.compare("name")) { name = (*it)->value(); - } else if (!prop.compare("orig_diskstream_id")) { + } else if (!prop.compare("orig-diskstream-id")) { ds_ok = true; } else { std::cerr << string_compose (X_("AudioPlaylistImporter did not recognise XML-property \"%1\""), prop) << endmsg; diff --git a/libs/ardour/audio_track_importer.cc b/libs/ardour/audio_track_importer.cc new file mode 100644 index 0000000000..752203f2cb --- /dev/null +++ b/libs/ardour/audio_track_importer.cc @@ -0,0 +1,152 @@ +/* + Copyright (C) 2008 Paul Davis + Author: Sakari Bergen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <ardour/audio_track_importer.h> + +#include <pbd/id.h> +#include <pbd/failed_constructor.h> + +#include "i18n.h" + +namespace ARDOUR { + +/*** AudioTrackImportHandler ***/ + +AudioTrackImportHandler::AudioTrackImportHandler (XMLTree const & source, Session & session) : + ElementImportHandler (source, session) +{ + XMLNode const * root = source.root(); + XMLNode const * routes; + + if (!(routes = root->child ("Routes"))) { + throw failed_constructor(); + } + + XMLNodeList const & route_list = routes->children(); + for (XMLNodeList::const_iterator it = route_list.begin(); it != route_list.end(); ++it) { + const XMLProperty* type = (*it)->property("default-type"); + if ( !type || type->value() == "audio" ) { + try { + elements.push_back (ElementPtr ( new AudioTrackImporter (source, session, *this, **it))); + } catch (failed_constructor err) { + set_dirty(); + } + } + } +} + +string +AudioTrackImportHandler::get_info () const +{ + return _("Audio Tracks"); +} + + +/*** AudioTrackImporter ***/ + +AudioTrackImporter::AudioTrackImporter (XMLTree const & source, Session & session, AudioTrackImportHandler & handler, XMLNode const & node) : + ElementImporter (source, session), + xml_track ("Route") +{ + // TODO Parse top-level XML + + if (!parse_io (node)) { + throw failed_constructor(); + } + + XMLNodeList const & controllables = node.children ("controllable"); + for (XMLNodeList::const_iterator it = controllables.begin(); it != controllables.end(); ++it) { + parse_controllable (**it, xml_track); + } + + // TODO parse remote-control and extra? + +} + +string +AudioTrackImporter::get_info () const +{ + // TODO + return name; +} + +bool +AudioTrackImporter::prepare_move () +{ + // TODO + return false; +} + +void +AudioTrackImporter::cancel_move () +{ + // TODO +} + +void +AudioTrackImporter::move () +{ + // TODO +} + +bool +AudioTrackImporter::parse_io (XMLNode const & node) +{ + XMLNode * io; + XMLProperty * prop; + + if (!(io = node.child ("IO"))) { + return false; + } + + if ((prop = io->property ("name"))) { + name = prop->value(); + } else { + return false; + } + + // TODO parse rest of the XML + + return true; +} + +bool +AudioTrackImporter::parse_controllable (XMLNode const & node, XMLNode & dest_parent) +{ + XMLProperty * prop; + XMLNode new_node (node); + + if ((prop = new_node.property ("id"))) { + PBD::ID old_id (prop->value()); + PBD::ID new_id; + + prop->set_value (new_id.to_s()); + // TODO do id mapping and everything else necessary... + + } else { + return false; + } + + dest_parent.add_child_copy (new_node); + + return true; +} + +} // namespace ARDOUR diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 600ce9e3ea..2576620ec2 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -722,6 +722,8 @@ ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings, /* Check format and maximum channel count */ if (!format || !format->type()) { warnings->errors.push_back (_("No format selected!")); + } else if (!channel_config->get_n_chans()) { + warnings->errors.push_back (_("All channels are empty!")); } else if (!ExportFileFactory::check (format, channel_config->get_n_chans())) { warnings->errors.push_back (_("One or more of the selected formats is not compatible with this system!")); } else if (format->channel_limit() < channel_config->get_n_chans()) { diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 0438d808a0..2e19041b9c 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -92,8 +92,8 @@ Session::pre_export () _exporting = true; export_status->running = true; - export_abort_connection = export_status->Aborting.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::stop_audio_export))); - export_abort_connection = export_status->Finished.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::finalize_audio_export))); + export_status->Aborting.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::stop_audio_export))); + export_status->Finished.connect (sigc::hide_return (sigc::mem_fun (*this, &Session::finalize_audio_export))); return 0; } @@ -239,7 +239,6 @@ Session::finalize_audio_export () ProcessExport.clear(); ExportReadFinished.clear(); export_freewheel_connection.disconnect(); - export_abort_connection.disconnect(); export_handler.reset(); export_status.reset(); |