-#include <ardour/session.h>
-#include <ardour/region.h>
-#include <ardour/source_factory.h>
-#include <ardour/region_factory.h>
-#include <ardour/session_directory.h>
+#include "ardour/session.h"
+#include "ardour/region.h"
+#include "ardour/source_factory.h"
+#include "ardour/region_factory.h"
+#include "ardour/session_directory.h"
-AudioRegionImporter::AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node) :
+AudioRegionImporter::AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node) :
nframes_t length, position;
SMPTE::Time length_time, position_time;
std::ostringstream oss;
nframes_t length, position;
SMPTE::Time length_time, position_time;
std::ostringstream oss;
// Get sample positions
std::istringstream iss_length(xml_region.property ("length")->value());
iss_length >> length;
std::istringstream iss_position(xml_region.property ("position")->value());
iss_position >> position;
// Get sample positions
std::istringstream iss_length(xml_region.property ("length")->value());
iss_length >> length;
std::istringstream iss_position(xml_region.property ("position")->value());
iss_position >> position;
// Convert to smpte
session.sample_to_smpte(length, length_time, true, false);
session.sample_to_smpte(position, position_time, true, false);
// Convert to smpte
session.sample_to_smpte(length, length_time, true, false);
session.sample_to_smpte(position, position_time, true, false);
for (XMLPropertyList::const_iterator it = props.begin(); it != props.end(); ++it) {
string prop = (*it)->name();
if (!prop.compare ("type") || !prop.compare ("stretch") ||
for (XMLPropertyList::const_iterator it = props.begin(); it != props.end(); ++it) {
string prop = (*it)->name();
if (!prop.compare ("type") || !prop.compare ("stretch") ||
std::cerr << string_compose (X_("AudioRegionImporter (%1): did not recognise XML-property \"%2\""), name, prop) << endmsg;
}
}
std::cerr << string_compose (X_("AudioRegionImporter (%1): did not recognise XML-property \"%2\""), name, prop) << endmsg;
}
}
// Get XML for sources
if (!(source_node = source.root()->child (X_("Sources")))) {
return false;
}
XMLNodeList const & sources = source_node->children();
// Get XML for sources
if (!(source_node = source.root()->child (X_("Sources")))) {
return false;
}
XMLNodeList const & sources = source_node->children();
// Get source for each channel
if (!(prop = xml_region.property ("channels"))) {
error << string_compose (X_("AudioRegionImporter (%1): did not find necessary XML-property \"channels\""), name) << endmsg;
return false;
}
// Get source for each channel
if (!(prop = xml_region.property ("channels"))) {
error << string_compose (X_("AudioRegionImporter (%1): did not find necessary XML-property \"channels\""), name) << endmsg;
return false;
}
channels = atoi (prop->value());
for (uint32_t i = 0; i < channels; ++i) {
bool source_found = false;
channels = atoi (prop->value());
for (uint32_t i = 0; i < channels; ++i) {
bool source_found = false;
// Get id for source-n
snprintf (buf, sizeof(buf), X_("source-%d"), i);
prop = xml_region.property (buf);
// Get id for source-n
snprintf (buf, sizeof(buf), X_("source-%d"), i);
prop = xml_region.property (buf);
// Get source
for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); it++) {
prop = (*it)->property ("id");
// Get source
for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); it++) {
prop = (*it)->property ("id");
source_dir = source_dir.branch_path();
SessionDirectory session_dir(source_dir);
source_dir = session_dir.sound_path();
source_dir = source_dir.branch_path();
SessionDirectory session_dir(source_dir);
source_dir = session_dir.sound_path();
// Create source list
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
source_list.push_back (handler.get_source (*it));
}
// Create source list
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
source_list.push_back (handler.get_source (*it));
}
// create region and update XML
region.push_back (RegionFactory::create (source_list, xml_region));
if (*region.begin()) {
// create region and update XML
region.push_back (RegionFactory::create (source_list, xml_region));
if (*region.begin()) {
// Get sources that still need to be imported
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
if (!handler.check_source (*it)) {
status.paths.push_back (*it);
// Get sources that still need to be imported
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
if (!handler.check_source (*it)) {
status.paths.push_back (*it);
// Add imported sources to handlers map
std::vector<Glib::ustring>::iterator file_it = status.paths.begin();
for (SourceList::iterator source_it = status.sources.begin(); source_it != status.sources.end(); ++source_it) {
// Add imported sources to handlers map
std::vector<Glib::ustring>::iterator file_it = status.paths.begin();
for (SourceList::iterator source_it = status.sources.begin(); source_it != status.sources.end(); ++source_it) {
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
session.add_source (handler.get_source (*it));
}
}
for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
session.add_source (handler.get_source (*it));
}
}