X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fregion_factory.h;h=dfbcd480dd675ff5e2a9576d06b4648c524461b1;hb=c8228ba9853b4f0ee452343b1f1e361c584236cf;hp=f9ed868f4fc043156310136793cb86bfdc6de100;hpb=aa78fb928b116c63a883679d2d199063a68c9bce;p=ardour.git diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index f9ed868f4f..dfbcd480dd 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -28,7 +28,6 @@ #include "pbd/signals.h" #include "ardour/types.h" -#include "ardour/region.h" class XMLNode; @@ -38,14 +37,13 @@ class Session; class AudioRegion; class RegionFactory { +public: + typedef std::map > RegionMap; - public: - typedef std::map > RegionMap; - - static boost::shared_ptr wholefile_region_by_name (const std::string& name); + static boost::shared_ptr wholefile_region_by_name (const std::string& name); static boost::shared_ptr region_by_id (const PBD::ID&); static boost::shared_ptr region_by_name (const std::string& name); - static const RegionMap all_regions() { return region_map; } + static const RegionMap all_regions() { return region_map; } static void clear_map (); /** This is emitted only when a new id is assigned. Therefore, @@ -61,47 +59,64 @@ class RegionFactory { static boost::shared_ptr create (boost::shared_ptr other, bool announce = false); /** create a region from a single Source */ - static boost::shared_ptr create (boost::shared_ptr, - const PBD::PropertyList&, bool announce = true); + static boost::shared_ptr create (boost::shared_ptr, + const PBD::PropertyList&, bool announce = true); + /** create a region from a multiple sources */ - static boost::shared_ptr create (const SourceList &, - const PBD::PropertyList&, bool announce = true); + static boost::shared_ptr create (const SourceList &, + const PBD::PropertyList&, bool announce = true); /** create a copy of @other starting at zero within @param other's sources */ - static boost::shared_ptr create (boost::shared_ptr other, - const PBD::PropertyList&, bool announce = true); + static boost::shared_ptr create (boost::shared_ptr other, + const PBD::PropertyList&, bool announce = true); /** create a copy of @param other starting at @param offset within @param other */ - static boost::shared_ptr create (boost::shared_ptr other, frameoffset_t offset, - const PBD::PropertyList&, bool announce = true); + static boost::shared_ptr create (boost::shared_ptr other, frameoffset_t offset, + const PBD::PropertyList&, bool announce = true); /** create a "copy" of @param other but using a different set of sources @param srcs */ - static boost::shared_ptr create (boost::shared_ptr other, const SourceList& srcs, - const PBD::PropertyList&, bool announce = true); - + static boost::shared_ptr create (boost::shared_ptr other, const SourceList& srcs, + const PBD::PropertyList&, bool announce = true); + /** create a region with no sources, using XML state */ static boost::shared_ptr create (Session&, XMLNode&, bool); /** create a region with specified sources @param srcs and XML state */ static boost::shared_ptr create (SourceList& srcs, const XMLNode&); - static void get_regions_using_source (boost::shared_ptr, std::set >& ); + static void get_regions_using_source (boost::shared_ptr, std::set >& ); + static void remove_regions_using_source (boost::shared_ptr); static void map_remove (boost::shared_ptr); static void map_remove_with_equivalents (boost::shared_ptr); - static void delete_all_regions (); - static const RegionMap& regions() { return region_map; } - static uint32_t nregions (); + static void delete_all_regions (); + static const RegionMap& regions() { return region_map; } + static uint32_t nregions (); static int region_name (std::string &, std::string, bool new_level = false); static std::string new_region_name (std::string); - - private: + static std::string compound_region_name (const std::string& playlist, uint32_t compound_ops, uint32_t depth, bool whole_source); + + /* when we make a compound region, for every region involved there + * are two "instances" - the original, which is removed from this + * playlist, and a copy, which is added to the playlist used as + * the source for the compound. + * + * when we uncombine, we want to put the originals back into this + * playlist after we remove the compound. this map lets us + * look them up easily. note that if the compound was trimmed or + * split, we may have to trim the originals + * and they may not be added back if the compound was trimmed + * or split sufficiently. + */ + + typedef std::map, boost::shared_ptr > CompoundAssociations; + static CompoundAssociations& compound_associations() { return _compound_associations; } + + static void add_compound_association (boost::shared_ptr, boost::shared_ptr); - static boost::shared_ptr create (boost::shared_ptr, frameoffset_t offset, - bool offset_relative, - const PBD::PropertyList&, bool announce = true); + private: static void region_changed (PBD::PropertyChange const &, boost::weak_ptr); - - static Glib::StaticMutex region_map_lock; - + + static Glib::StaticMutex region_map_lock; + static RegionMap region_map; static void map_add (boost::shared_ptr); @@ -110,7 +125,8 @@ class RegionFactory { static std::map region_name_map; static void update_region_name_map (boost::shared_ptr); - static PBD::ScopedConnectionList region_list_connections; + static PBD::ScopedConnectionList region_list_connections; + static CompoundAssociations _compound_associations; }; }