* 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
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <ardour/audio_region_importer.h>
|
||||
#include <ardour/audio_playlist_importer.h>
|
||||
#include <ardour/audio_track_importer.h>
|
||||
#include <ardour/location_importer.h>
|
||||
#include <ardour/tempo_map_importer.h>
|
||||
|
||||
@@ -110,6 +111,7 @@ SessionImportDialog::load_session (const string& filename)
|
||||
handlers.push_back (HandlerPtr(region_handler));
|
||||
handlers.push_back (HandlerPtr(new AudioPlaylistImportHandler (tree, target, *region_handler)));
|
||||
handlers.push_back (HandlerPtr(new UnusedAudioPlaylistImportHandler (tree, target, *region_handler)));
|
||||
handlers.push_back (HandlerPtr(new AudioTrackImportHandler (tree, target)));
|
||||
handlers.push_back (HandlerPtr(new LocationImportHandler (tree, target)));
|
||||
handlers.push_back (HandlerPtr(new TempoMapImportHandler (tree, target)));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
64
libs/ardour/ardour/audio_track_importer.h
Normal file
64
libs/ardour/ardour/audio_track_importer.h
Normal file
@@ -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
|
||||
@@ -36,7 +36,7 @@ enum ExportStage {
|
||||
export_Write
|
||||
};
|
||||
|
||||
struct ExportStatus {
|
||||
struct ExportStatus : public sigc::trackable {
|
||||
|
||||
ExportStatus ();
|
||||
void init ();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
152
libs/ardour/audio_track_importer.cc
Normal file
152
libs/ardour/audio_track_importer.cc
Normal file
@@ -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
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user