diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-11-26 17:13:50 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2008-11-26 17:13:50 +0000 |
commit | 38382b792113cbf23881c1dca64e16c2d0207d45 (patch) | |
tree | 5fb1185a6f21ecc769a4c229fc0f6b7415eabaf5 /libs/ardour/ardour | |
parent | 95a86871c028ab7f0ae16608adb9b86495678d50 (diff) |
More work on track import and some cleaning up of ElementImporter interface
git-svn-id: svn://localhost/ardour2/branches/3.0@4265 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_playlist_importer.h | 22 | ||||
-rw-r--r-- | libs/ardour/ardour/audio_region_importer.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/audio_track_importer.h | 34 | ||||
-rw-r--r-- | libs/ardour/ardour/element_importer.h | 40 | ||||
-rw-r--r-- | libs/ardour/ardour/location_importer.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo_map_importer.h | 8 |
6 files changed, 87 insertions, 33 deletions
diff --git a/libs/ardour/ardour/audio_playlist_importer.h b/libs/ardour/ardour/audio_playlist_importer.h index a3e72f18c8..b94523128f 100644 --- a/libs/ardour/ardour/audio_playlist_importer.h +++ b/libs/ardour/ardour/audio_playlist_importer.h @@ -38,16 +38,22 @@ namespace ARDOUR { class AudioRegionImportHandler; class AudioRegionImporter; +class AudioPlaylistImporter; class AudioPlaylistImportHandler : public ElementImportHandler { public: + typedef boost::shared_ptr<AudioPlaylistImporter> PlaylistPtr; + typedef std::list<PlaylistPtr> PlaylistList; + 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 get_regions (XMLNode const & node, ElementList & list) const; void update_region_id (XMLProperty* id_prop); + + void playlists_by_diskstream (PBD::ID const & id, PlaylistList & list) const; protected: AudioRegionImportHandler & region_handler; @@ -65,19 +71,27 @@ class AudioPlaylistImporter : public ElementImporter { public: AudioPlaylistImporter (XMLTree const & source, Session & session, AudioPlaylistImportHandler & handler, XMLNode const & node); + AudioPlaylistImporter (AudioPlaylistImporter const & other); string get_info () const; - bool prepare_move (); - void cancel_move (); - void move (); void set_diskstream (PBD::ID const & id); + PBD::ID const & orig_diskstream () const { return orig_diskstream_id; } + + protected: + bool _prepare_move (); + void _cancel_move (); + void _move (); private: typedef std::list<boost::shared_ptr<AudioRegionImporter> > RegionList; + void populate_region_list (); + AudioPlaylistImportHandler & handler; + XMLNode const & orig_node; XMLNode xml_playlist; + PBD::ID orig_diskstream_id; PBD::ID diskstream_id; RegionList regions; }; diff --git a/libs/ardour/ardour/audio_region_importer.h b/libs/ardour/ardour/audio_region_importer.h index a2205390ab..8123f89e42 100644 --- a/libs/ardour/ardour/audio_region_importer.h +++ b/libs/ardour/ardour/audio_region_importer.h @@ -75,14 +75,16 @@ class AudioRegionImporter : public ElementImporter // 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 (); + protected: + bool _prepare_move (); + void _cancel_move (); + void _move (); + private: XMLNode xml_region; diff --git a/libs/ardour/ardour/audio_track_importer.h b/libs/ardour/ardour/audio_track_importer.h index 172776863e..6beee4a408 100644 --- a/libs/ardour/ardour/audio_track_importer.h +++ b/libs/ardour/ardour/audio_track_importer.h @@ -21,44 +21,68 @@ #ifndef __ardour_audio_track_importer_h__ #define __ardour_audio_track_importer_h__ +#include <list> + #include <pbd/xml++.h> +#include <pbd/id.h> #include <ardour/element_importer.h> #include <ardour/element_import_handler.h> namespace ARDOUR { +class AudioPlaylistImportHandler; +class AudioPlaylistImporter; class AudioTrackImportHandler : public ElementImportHandler { public: - AudioTrackImportHandler (XMLTree const & source, Session & session); + AudioTrackImportHandler (XMLTree const & source, Session & session, AudioPlaylistImportHandler & pl_handler); virtual ~AudioTrackImportHandler () {} virtual string get_info () const; + + private: + AudioPlaylistImportHandler & pl_handler; }; class AudioTrackImporter : public ElementImporter { public: - AudioTrackImporter (XMLTree const & source, Session & session, AudioTrackImportHandler & handler, XMLNode const & node); + AudioTrackImporter (XMLTree const & source, + Session & session, + AudioTrackImportHandler & track_handler, + XMLNode const & node, + AudioPlaylistImportHandler & pl_handler); string get_info () const; - bool prepare_move (); - void cancel_move (); - void move (); + + protected: + bool _prepare_move (); + void _cancel_move (); + void _move (); private: + typedef boost::shared_ptr<AudioPlaylistImporter> PlaylistPtr; + typedef std::list<PlaylistPtr> PlaylistList; + bool parse_route_xml (); bool parse_io (); bool parse_processor (XMLNode & node); bool parse_controllable (XMLNode & node); bool parse_automation (XMLNode & node); + bool rate_convert_events (XMLNode & node); + AudioTrackImportHandler & track_handler; XMLNode xml_track; + PBD::ID old_ds_id; + PBD::ID new_ds_id; + + PlaylistList playlists; + AudioPlaylistImportHandler & pl_handler; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index 34ab0a7cc6..7979fbd0a4 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -41,7 +41,7 @@ class ElementImporter public: ElementImporter (XMLTree const & source, ARDOUR::Session & session); - virtual ~ElementImporter () {}; + virtual ~ElementImporter (); /** Returns the element name * @return the name of the element @@ -54,27 +54,18 @@ class ElementImporter 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; + bool prepare_move (); /** 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; + void cancel_move (); - /** 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; + /// Moves the element to the taget session + void move (); /// Check if element is broken. Cannot be moved if broken. bool broken () { return _broken; } @@ -86,6 +77,24 @@ class ElementImporter static sigc::signal <bool, string> Prompt; protected: + + /** 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; + + /** 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. + * + * @return whether or not the element can be moved + */ + virtual bool _prepare_move () = 0; + + /// Cancel move + virtual void _cancel_move () = 0; + /// Source XML-tree XMLTree const & source; @@ -93,7 +102,7 @@ class ElementImporter ARDOUR::Session & session; /// Ture if the element has been prepared and queued for importing - bool queued; + bool queued () { return _queued; } /// Name of element string name; @@ -114,6 +123,7 @@ class ElementImporter void set_broken () { _broken = true; } private: + bool _queued; bool _broken; }; diff --git a/libs/ardour/ardour/location_importer.h b/libs/ardour/ardour/location_importer.h index 7066151383..589bc2e94e 100644 --- a/libs/ardour/ardour/location_importer.h +++ b/libs/ardour/ardour/location_importer.h @@ -46,9 +46,11 @@ class LocationImporter : public ElementImporter ~LocationImporter (); string get_info () const; - bool prepare_move (); - void cancel_move (); - void move (); + + protected: + bool _prepare_move (); + void _cancel_move (); + void _move (); private: LocationImportHandler & handler; diff --git a/libs/ardour/ardour/tempo_map_importer.h b/libs/ardour/ardour/tempo_map_importer.h index 6c2a057943..40ad126900 100644 --- a/libs/ardour/ardour/tempo_map_importer.h +++ b/libs/ardour/ardour/tempo_map_importer.h @@ -47,9 +47,11 @@ class TempoMapImporter : public ElementImporter 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 (); + + protected: + bool _prepare_move (); + void _cancel_move (); + void _move (); private: XMLNode xml_tempo_map; |