2 Copyright (C) 2008 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_audio_region_importer_h__
22 #define __ardour_audio_region_importer_h__
28 #include <boost/shared_ptr.hpp>
30 #include "pbd/xml++.h"
32 #include "pbd/filesystem.h"
33 #include "ardour/element_importer.h"
34 #include "ardour/element_import_handler.h"
35 #include "ardour/import_status.h"
43 class AudioRegionImportHandler : public ElementImportHandler
46 // Inerface implementation
47 AudioRegionImportHandler (XMLTree const & source, Session & session);
48 std::string get_info () const;
50 void create_regions_from_children (XMLNode const & node, ElementList & list);
53 bool check_source (std::string const & filename) const;
54 void add_source (std::string const & filename, boost::shared_ptr<Source> const & source);
55 boost::shared_ptr<Source> const & get_source (std::string const & filename) const;
58 void register_id (PBD::ID & old_id, PBD::ID & new_id);
59 PBD::ID const & get_new_id (PBD::ID & old_id) const;
63 typedef std::map<std::string, boost::shared_ptr<Source> > SourceMap;
64 typedef std::pair<std::string, boost::shared_ptr<Source> > SourcePair;
68 typedef std::map<PBD::ID, PBD::ID> IdMap;
69 typedef std::pair<PBD::ID, PBD::ID> IdPair;
73 class AudioRegionImporter : public ElementImporter
76 AudioRegionImporter (XMLTree const & source, Session & session, AudioRegionImportHandler & handler, XMLNode const & node);
77 ~AudioRegionImporter ();
79 // Interface implementation
80 std::string get_info () const;
81 ImportStatus * get_import_status () { return &status; }
84 void add_sources_to_session ();
85 XMLNode const & get_xml ();
88 bool _prepare_move ();
95 AudioRegionImportHandler & handler;
98 std::list<std::string> filenames;
101 bool parse_xml_region ();
102 bool parse_source_xml ();
103 PBD::sys::path get_sound_dir (XMLTree const & tree);
105 void prepare_region ();
106 void prepare_sources ();
107 std::vector<boost::shared_ptr<Region> > region;
108 bool region_prepared;
109 bool sources_prepared;
112 } // namespace ARDOUR