summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/audio_region_importer.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour/audio_region_importer.h')
-rw-r--r--libs/ardour/ardour/audio_region_importer.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/libs/ardour/ardour/audio_region_importer.h b/libs/ardour/ardour/audio_region_importer.h
new file mode 100644
index 0000000000..a2205390ab
--- /dev/null
+++ b/libs/ardour/ardour/audio_region_importer.h
@@ -0,0 +1,107 @@
+/*
+ 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_region_importer_h__
+#define __ardour_audio_region_importer_h__
+
+#include <list>
+#include <map>
+#include <utility>
+
+#include <boost/shared_ptr.hpp>
+
+#include <pbd/xml++.h>
+#include <pbd/id.h>
+#include <pbd/filesystem.h>
+#include <ardour/types.h>
+#include <ardour/element_importer.h>
+#include <ardour/element_import_handler.h>
+
+namespace ARDOUR {
+
+class Region;
+
+class AudioRegionImportHandler : public ElementImportHandler
+{
+ public:
+ // Inerface implementation
+ AudioRegionImportHandler (XMLTree const & source, Session & session);
+ string get_info () const;
+
+ void create_regions_from_children (XMLNode const & node, ElementList & list);
+
+ // Source management
+ bool check_source (string const & filename) const;
+ void add_source (string const & filename, boost::shared_ptr<Source> const & source);
+ boost::shared_ptr<Source> const & get_source (string const & filename) const;
+
+ // Id management
+ void register_id (PBD::ID & old_id, PBD::ID & new_id);
+ PBD::ID const & get_new_id (PBD::ID & old_id) const;
+
+ private:
+ // Source management
+ typedef std::map<string, boost::shared_ptr<Source> > SourceMap;
+ typedef std::pair<string, boost::shared_ptr<Source> > SourcePair;
+ SourceMap sources;
+
+ // Id management
+ typedef std::map<PBD::ID, PBD::ID> IdMap;
+ typedef std::pair<PBD::ID, PBD::ID> IdPair;
+ IdMap id_map;
+};
+
+class AudioRegionImporter : public ElementImporter
+{
+ public:
+ AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node);
+
+ // Interface implementation
+ string get_info () const;
+ bool prepare_move ();
+ void cancel_move ();
+ void move ();
+
+ // other stuff
+ void add_sources_to_session ();
+ XMLNode const & get_xml ();
+
+ private:
+
+ XMLNode xml_region;
+ AudioRegionImportHandler & handler;
+ PBD::ID old_id;
+ PBD::ID id;
+ std::list<string> filenames;
+
+ bool parse_xml_region ();
+ bool parse_source_xml ();
+ PBD::sys::path get_sound_dir (XMLTree const & tree);
+
+ void prepare_region ();
+ void prepare_sources ();
+ std::vector<boost::shared_ptr<Region> > region;
+ bool region_prepared;
+ bool sources_prepared;
+};
+
+} // namespace ARDOUR
+
+#endif