X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fregion_factory.h;h=ed0c962d879a7adae199e410b830a56d574e6984;hb=5cf1f7f3b28abd36f9390014016def94f4e1468d;hp=90716f8718acf0b0d00e5cd0d49283a7535fc691;hpb=e984220eaaa318d9b51ebb20995d1bccae389389;p=ardour.git diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index 90716f8718..ed0c962d87 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -22,14 +22,16 @@ #include #include -#include +#include #include "pbd/id.h" +#include "pbd/property_list.h" #include "pbd/signals.h" #include "ardour/types.h" class XMLNode; +class RegionNamingTest; namespace ARDOUR { @@ -59,22 +61,22 @@ public: 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, + 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 &, + 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, + 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, + 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, + 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 */ @@ -83,8 +85,7 @@ public: 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 map_remove (boost::weak_ptr); static void delete_all_regions (); static const RegionMap& regions() { return region_map; } static uint32_t nregions (); @@ -92,10 +93,10 @@ public: static int region_name (std::string &, std::string, bool new_level = false); static std::string new_region_name (std::string); 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 + * 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 @@ -110,22 +111,34 @@ public: static CompoundAssociations& compound_associations() { return _compound_associations; } static void add_compound_association (boost::shared_ptr, boost::shared_ptr); - + + /* exposed because there may be cases where regions are created with + * announce=false but they still need to be in the map soon after + * creation. + */ + + static void map_add (boost::shared_ptr); + private: + friend class ::RegionNamingTest; static void region_changed (PBD::PropertyChange const &, boost::weak_ptr); - - static Glib::StaticMutex region_map_lock; - - static RegionMap region_map; - static void map_add (boost::shared_ptr); - static Glib::StaticMutex region_name_map_lock; + static Glib::Threads::Mutex region_map_lock; - static std::map region_name_map; - static void update_region_name_map (boost::shared_ptr); + static RegionMap region_map; - static PBD::ScopedConnectionList region_list_connections; + static Glib::Threads::Mutex region_name_maps_mutex; + /** map of partial region names and suffix numbers */ + static std::map region_name_number_map; + /** map of complete region names with their region ID */ + static std::map region_name_map; + static void add_to_region_name_maps (boost::shared_ptr); + static void rename_in_region_name_maps (boost::shared_ptr); + static void update_region_name_number_map (boost::shared_ptr); + static void remove_from_region_name_map (std::string); + + static PBD::ScopedConnectionList* region_list_connections; static CompoundAssociations _compound_associations; };