summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_playlist_importer.h87
-rw-r--r--libs/ardour/ardour/audio_region_importer.h107
-rw-r--r--libs/ardour/ardour/element_import_handler.h110
-rw-r--r--libs/ardour/ardour/element_importer.h122
-rw-r--r--libs/ardour/ardour/location.h1
-rw-r--r--libs/ardour/ardour/location_importer.h63
-rw-r--r--libs/ardour/ardour/playlist_factory.h4
-rw-r--r--libs/ardour/ardour/session.h3
-rw-r--r--libs/ardour/ardour/tempo_map_importer.h60
9 files changed, 554 insertions, 3 deletions
diff --git a/libs/ardour/ardour/audio_playlist_importer.h b/libs/ardour/ardour/audio_playlist_importer.h
new file mode 100644
index 0000000000..a3e72f18c8
--- /dev/null
+++ b/libs/ardour/ardour/audio_playlist_importer.h
@@ -0,0 +1,87 @@
+/*
+ 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_playlist_importer_h__
+#define __ardour_audio_playlist_importer_h__
+
+#include <list>
+
+#include <boost/shared_ptr.hpp>
+
+#include <pbd/xml++.h>
+#include <pbd/id.h>
+
+#include <ardour/element_importer.h>
+#include <ardour/element_import_handler.h>
+#include <ardour/types.h>
+
+#include "i18n.h"
+
+namespace ARDOUR {
+
+class AudioRegionImportHandler;
+class AudioRegionImporter;
+
+class AudioPlaylistImportHandler : public ElementImportHandler
+{
+ public:
+ AudioPlaylistImportHandler (XMLTree const & source, Session & session, AudioRegionImportHandler & region_handler, const char * nodename = "Playlists");
+ virtual ~AudioPlaylistImportHandler () {}
+ virtual string get_info () const;
+
+ void get_regions (XMLNode const & node, ElementList & list);
+ void update_region_id (XMLProperty* id_prop);
+
+ protected:
+ AudioRegionImportHandler & region_handler;
+};
+
+class UnusedAudioPlaylistImportHandler : public AudioPlaylistImportHandler
+{
+ public:
+ UnusedAudioPlaylistImportHandler (XMLTree const & source, Session & session, AudioRegionImportHandler & region_handler) :
+ AudioPlaylistImportHandler (source, session, region_handler, X_("UnusedPlaylists")) { }
+ string get_info () const { return _("Audio Playlists (unused)"); }
+};
+
+class AudioPlaylistImporter : public ElementImporter
+{
+ public:
+ AudioPlaylistImporter (XMLTree const & source, Session & session, AudioPlaylistImportHandler & handler, XMLNode const & node);
+
+ string get_info () const;
+ bool prepare_move ();
+ void cancel_move ();
+ void move ();
+
+ void set_diskstream (PBD::ID const & id);
+
+ private:
+ typedef std::list<boost::shared_ptr<AudioRegionImporter> > RegionList;
+
+ AudioPlaylistImportHandler & handler;
+ XMLNode xml_playlist;
+ PBD::ID diskstream_id;
+ RegionList regions;
+};
+
+} // namespace ARDOUR
+
+#endif
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
diff --git a/libs/ardour/ardour/element_import_handler.h b/libs/ardour/ardour/element_import_handler.h
new file mode 100644
index 0000000000..9393c31559
--- /dev/null
+++ b/libs/ardour/ardour/element_import_handler.h
@@ -0,0 +1,110 @@
+/*
+ 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_element_import_handler_h__
+#define __ardour_element_import_handler_h__
+
+#include <string>
+#include <list>
+
+#include <boost/shared_ptr.hpp>
+
+using std::string;
+class XMLTree;
+
+namespace ARDOUR {
+
+class Session;
+class ElementImporter;
+
+/// Virtual interface class for element import handlers
+class ElementImportHandler
+{
+ public:
+ typedef boost::shared_ptr<ElementImporter> ElementPtr;
+ typedef std::list<ElementPtr> ElementList;
+
+ /** ElementImportHandler constructor
+ * The constructor should find everything from the XML Tree it can handle
+ * and create respective Elements stored in elements.
+ *
+ * @param source XML tree to be parsed
+ * @see elements
+ */
+ ElementImportHandler (XMLTree const & source, ARDOUR::Session & session) :
+ source (source), session (session) { }
+
+ virtual ~ElementImportHandler ();
+
+ /** Gets a textual representation of the element type
+ * @return textual representation of element type
+ */
+ virtual string get_info () const = 0;
+
+ /// Elements this handler handles
+ ElementList elements;
+
+ /* For checking duplicates names against queued elements */
+
+ /** Checks whether or not an element with some name is queued or not
+ * @param name name to check
+ * @return true if name is not used
+ */
+ bool check_name (const string & name) const;
+
+ /// Adds name to the list of used names
+ void add_name (string name);
+
+ /// Removes name from the list of used names
+ void remove_name (const string & name);
+
+ /// Checks wheter or not all elements can be imported cleanly
+ static bool dirty () { return _dirty; }
+
+ /// Sets handler dirty
+ static void set_dirty () { _dirty = true; }
+
+ /// Checks wheter or not all elements were imported cleanly
+ static bool errors () { return _errors; }
+
+ /// Sets handler dirty
+ static void set_errors () { _errors = true; }
+
+ protected:
+ /// Source session XML tree
+ XMLTree const & source;
+
+ /// Destination session
+ ARDOUR::Session & session;
+
+ /// Session XML readability
+ static bool _dirty;
+
+ /// Errors post initialization
+ static bool _errors;
+
+ private:
+ /// List of names for duplicate checking
+ std::list<string> names;
+};
+
+} // namespace ARDOUR
+
+#endif
diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h
new file mode 100644
index 0000000000..34ab0a7cc6
--- /dev/null
+++ b/libs/ardour/ardour/element_importer.h
@@ -0,0 +1,122 @@
+/*
+ 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_element_importer_h__
+#define __ardour_element_importer_h__
+
+#include <string>
+#include <utility>
+
+#include <sigc++/signal.h>
+
+#include <ardour/types.h>
+
+using std::string;
+
+class XMLTree;
+namespace ARDOUR {
+
+class Session;
+
+/// Virtual interface class for element importers
+class ElementImporter
+{
+ public:
+
+ ElementImporter (XMLTree const & source, ARDOUR::Session & session);
+ virtual ~ElementImporter () {};
+
+ /** Returns the element name
+ * @return the name of the element
+ */
+ virtual string get_name () const { return name; };
+
+ /** Gets a textual representation of the element
+ * @return a textual representation on this specific element
+ */
+ virtual string get_info () const = 0;
+
+ /** Prepares to move element
+ * Should take care of all tasks that need to be done
+ * before moving the element. This includes prompting
+ * the user for more information if necessary.
+ *
+ * If the element can be moved, queued should be set to true.
+ *
+ * @return whther or not the element could be prepared for moving
+ */
+ virtual bool prepare_move () = 0;
+
+ /** Cancels moving of element
+ * If the element has been set to be moved, this cancels the move.
+ * queued should be set to false.
+ */
+ virtual void cancel_move () = 0;
+
+ /** Moves the element to the taget session
+ * In addition to actually adding the element to the session
+ * changing ids, renaming files etc. should be taken care of.
+ */
+ virtual void move () = 0;
+
+ /// Check if element is broken. Cannot be moved if broken.
+ bool broken () { return _broken; }
+
+ /// Signal that requests for anew name
+ static sigc::signal <std::pair<bool, string>, string, string> Rename;
+
+ /// Signal for ok/cancel prompting
+ static sigc::signal <bool, string> Prompt;
+
+ protected:
+ /// Source XML-tree
+ XMLTree const & source;
+
+ /// Target session
+ ARDOUR::Session & session;
+
+ /// Ture if the element has been prepared and queued for importing
+ bool queued;
+
+ /// Name of element
+ string name;
+
+ /// The sample rate of the session from which we are importing
+ nframes_t sample_rate;
+
+ /// Converts smpte time to a string
+ string smpte_to_string(SMPTE::Time & time) const;
+
+ /// Converts samples so that times match the sessions sample rate
+ nframes_t rate_convert_samples (nframes_t samples) const;
+
+ /// Converts samples so that times match the sessions sample rate (for straight use in XML)
+ string rate_convert_samples (string const & samples) const;
+
+ /// Set element broken
+ void set_broken () { _broken = true; }
+
+ private:
+ bool _broken;
+};
+
+} // namespace ARDOUR
+
+#endif
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index d5b672a89d..ae0ec5acd8 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -99,6 +99,7 @@ class Location : public PBD::StatefulDestructible
void set_cd (bool yn, void *src);
void set_is_end (bool yn, void* src);
void set_is_start (bool yn, void* src);
+ void set_is_range_marker (bool yn, void* src);
bool is_auto_punch () const { return _flags & IsAutoPunch; }
bool is_auto_loop () const { return _flags & IsAutoLoop; }
diff --git a/libs/ardour/ardour/location_importer.h b/libs/ardour/ardour/location_importer.h
new file mode 100644
index 0000000000..7066151383
--- /dev/null
+++ b/libs/ardour/ardour/location_importer.h
@@ -0,0 +1,63 @@
+/*
+ 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_location_importer_h__
+#define __ardour_location_importer_h__
+
+#include <ardour/element_importer.h>
+#include <ardour/element_import_handler.h>
+
+#include <boost/shared_ptr.hpp>
+
+#include <pbd/xml++.h>
+#include <ardour/location.h>
+#include <ardour/types.h>
+
+namespace ARDOUR {
+
+class LocationImportHandler : public ElementImportHandler
+{
+ public:
+ LocationImportHandler (XMLTree const & source, Session & session);
+ string get_info () const;
+};
+
+class LocationImporter : public ElementImporter
+{
+ public:
+ LocationImporter (XMLTree const & source, Session & session, LocationImportHandler & handler, XMLNode const & node);
+ ~LocationImporter ();
+
+ string get_info () const;
+ bool prepare_move ();
+ void cancel_move ();
+ void move ();
+
+ private:
+ LocationImportHandler & handler;
+ XMLNode xml_location;
+ Location * location;
+
+ void parse_xml ();
+};
+
+} // namespace ARDOUR
+
+#endif
diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h
index a28e2611d9..239fa49a04 100644
--- a/libs/ardour/ardour/playlist_factory.h
+++ b/libs/ardour/ardour/playlist_factory.h
@@ -31,9 +31,9 @@ class Session;
class PlaylistFactory {
public:
- static sigc::signal<void,boost::shared_ptr<Playlist> > PlaylistCreated;
+ static sigc::signal<void,boost::shared_ptr<Playlist>, bool> PlaylistCreated;
- static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false);
+ static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false, bool unused = false);
static boost::shared_ptr<Playlist> create (DataType type, Session&, string name, bool hidden = false);
static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, string name, bool hidden = false);
static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, nframes_t start, nframes_t cnt, string name, bool hidden = false);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index fa074071c5..83e3200224 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -685,7 +685,8 @@ class Session : public PBD::StatefulDestructible
/* playlist management */
boost::shared_ptr<Playlist> playlist_by_name (string name);
- void add_playlist (boost::shared_ptr<Playlist>);
+ void unassigned_playlists (std::list<boost::shared_ptr<Playlist> > & list);
+ void add_playlist (boost::shared_ptr<Playlist>, bool unused = false);
sigc::signal<void,boost::shared_ptr<Playlist> > PlaylistAdded;
sigc::signal<void,boost::shared_ptr<Playlist> > PlaylistRemoved;
diff --git a/libs/ardour/ardour/tempo_map_importer.h b/libs/ardour/ardour/tempo_map_importer.h
new file mode 100644
index 0000000000..6c2a057943
--- /dev/null
+++ b/libs/ardour/ardour/tempo_map_importer.h
@@ -0,0 +1,60 @@
+/*
+ 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_tempo_map_importer_h__
+#define __ardour_tempo_map_importer_h__
+
+#include <boost/shared_ptr.hpp>
+
+#include <pbd/xml++.h>
+
+#include <ardour/element_importer.h>
+#include <ardour/element_import_handler.h>
+#include <ardour/tempo.h>
+#include <ardour/types.h>
+
+namespace ARDOUR {
+
+class TempoMapImportHandler : public ElementImportHandler
+{
+ public:
+ TempoMapImportHandler (XMLTree const & source, Session & session);
+ string get_info () const;
+};
+
+class TempoMapImporter : public ElementImporter
+{
+ private:
+ typedef boost::shared_ptr<XMLNode> XMLNodePtr;
+ public:
+ TempoMapImporter (XMLTree const & source, Session & session, XMLNode const & node);
+
+ virtual string get_info () const;
+ virtual bool prepare_move ();
+ virtual void cancel_move ();
+ virtual void move ();
+
+ private:
+ XMLNode xml_tempo_map;
+};
+
+} // namespace ARDOUR
+
+#endif