NO-OP: clang-format
This commit is contained in:
parent
3e04e30e9e
commit
747a3d4a7b
|
@ -24,16 +24,15 @@
|
||||||
#ifndef __ardour_region_factory_h__
|
#ifndef __ardour_region_factory_h__
|
||||||
#define __ardour_region_factory_h__
|
#define __ardour_region_factory_h__
|
||||||
|
|
||||||
|
#include <glibmm/threads.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <glibmm/threads.h>
|
|
||||||
|
|
||||||
#include "pbd/id.h"
|
#include "pbd/id.h"
|
||||||
#include "pbd/property_list.h"
|
#include "pbd/property_list.h"
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
#include "ardour/libardour_visibility.h"
|
#include "ardour/libardour_visibility.h"
|
||||||
#include "ardour/thawlist.h"
|
|
||||||
#include "ardour/types.h"
|
#include "ardour/types.h"
|
||||||
|
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
@ -41,52 +40,52 @@ class RegionNamingTest;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
||||||
class Session;
|
|
||||||
class AudioRegion;
|
class AudioRegion;
|
||||||
|
class Session;
|
||||||
|
class ThawList;
|
||||||
|
|
||||||
class LIBARDOUR_API RegionFactory {
|
class LIBARDOUR_API RegionFactory
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::map<PBD::ID,boost::shared_ptr<Region> > RegionMap;
|
typedef std::map<PBD::ID, boost::shared_ptr<Region> > RegionMap;
|
||||||
|
|
||||||
static boost::shared_ptr<Region> wholefile_region_by_name (const std::string& name);
|
static boost::shared_ptr<Region> wholefile_region_by_name (const std::string& name);
|
||||||
static boost::shared_ptr<Region> region_by_id (const PBD::ID&);
|
static boost::shared_ptr<Region> region_by_id (const PBD::ID&);
|
||||||
static boost::shared_ptr<Region> region_by_name (const std::string& name);
|
static boost::shared_ptr<Region> region_by_name (const std::string& name);
|
||||||
static const RegionMap all_regions() { return region_map; }
|
static void clear_map ();
|
||||||
static void clear_map ();
|
static const RegionMap all_regions ()
|
||||||
|
{
|
||||||
|
return region_map;
|
||||||
|
}
|
||||||
|
|
||||||
/** This is emitted only when a new id is assigned. Therefore,
|
/** This is emitted only when a new id is assigned. Therefore,
|
||||||
in a pure Region copy, it will not be emitted.
|
* in a pure Region copy, it will not be emitted.
|
||||||
|
*
|
||||||
It must be emitted using a derived instance of Region, not Region
|
* It must be emitted using a derived instance of Region, not Region
|
||||||
itself, to permit dynamic_cast<> to be used to
|
* itself, to permit dynamic_cast<> to be used to
|
||||||
infer the type of Region.
|
* infer the type of Region.
|
||||||
*/
|
*/
|
||||||
static PBD::Signal1<void,boost::shared_ptr<Region> > CheckNewRegion;
|
static PBD::Signal1<void, boost::shared_ptr<Region> > CheckNewRegion;
|
||||||
|
|
||||||
/** create a "pure copy" of Region \p other */
|
/** create a "pure copy" of Region \p other */
|
||||||
static boost::shared_ptr<Region> create (boost::shared_ptr<const Region> other, bool announce, bool fork = false, ThawList* tl = 0);
|
static boost::shared_ptr<Region> create (boost::shared_ptr<const Region> other, bool announce, bool fork = false, ThawList* tl = 0);
|
||||||
|
|
||||||
/** Lua binding to create a "pure copy" of Region \p other */
|
/** Lua binding to create a "pure copy" of Region \p other */
|
||||||
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, bool announce, bool fork) {
|
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, bool announce, bool fork)
|
||||||
return create (boost::shared_ptr<const Region>(other), announce, fork, 0);
|
{
|
||||||
|
return create (boost::shared_ptr<const Region> (other), announce, fork, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** create a region from a single Source */
|
/** create a region from a single Source */
|
||||||
static boost::shared_ptr<Region> create (boost::shared_ptr<Source>,
|
static boost::shared_ptr<Region> create (boost::shared_ptr<Source>, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
||||||
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
|
||||||
|
|
||||||
/** create a region from a multiple sources */
|
/** create a region from a multiple sources */
|
||||||
static boost::shared_ptr<Region> create (const SourceList &,
|
static boost::shared_ptr<Region> create (const SourceList&, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
||||||
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
|
||||||
/** create a copy of \p other starting at zero within \p other's sources */
|
/** create a copy of \p other starting at zero within \p other's sources */
|
||||||
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other,
|
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
||||||
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
|
||||||
/** create a copy of \p other starting at \p offset within \p other */
|
/** create a copy of \p other starting at \p offset within \p other */
|
||||||
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicSample offset,
|
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicSample offset, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
||||||
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
|
||||||
/** create a "copy" of \p other but using a different set of sources \p srcs */
|
/** create a "copy" of \p other but using a different set of sources \p srcs */
|
||||||
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs,
|
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
||||||
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
|
|
||||||
|
|
||||||
/** create a region with no sources, using XML state */
|
/** create a region with no sources, using XML state */
|
||||||
static boost::shared_ptr<Region> create (Session&, XMLNode&, bool);
|
static boost::shared_ptr<Region> create (Session&, XMLNode&, bool);
|
||||||
|
@ -94,25 +93,29 @@ public:
|
||||||
static boost::shared_ptr<Region> create (SourceList& srcs, const XMLNode&);
|
static boost::shared_ptr<Region> create (SourceList& srcs, const XMLNode&);
|
||||||
|
|
||||||
static boost::shared_ptr<Region> get_whole_region_for_source (boost::shared_ptr<ARDOUR::Source>);
|
static boost::shared_ptr<Region> get_whole_region_for_source (boost::shared_ptr<ARDOUR::Source>);
|
||||||
|
|
||||||
static void get_regions_using_source (boost::shared_ptr<Source>, std::set<boost::shared_ptr<Region> >& );
|
static void get_regions_using_source (boost::shared_ptr<Source>, std::set<boost::shared_ptr<Region> >&);
|
||||||
static void remove_regions_using_source (boost::shared_ptr<Source>);
|
static void remove_regions_using_source (boost::shared_ptr<Source>);
|
||||||
|
|
||||||
static void map_remove (boost::weak_ptr<Region>);
|
static void map_remove (boost::weak_ptr<Region>);
|
||||||
static void delete_all_regions ();
|
static void delete_all_regions ();
|
||||||
static const RegionMap& regions() { return region_map; }
|
|
||||||
|
static const RegionMap& regions ()
|
||||||
|
{
|
||||||
|
return region_map;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t nregions ();
|
static uint32_t nregions ();
|
||||||
|
|
||||||
static void foreach_region (boost::function<void( boost::shared_ptr<Region> )> f) {
|
static void foreach_region (boost::function<void (boost::shared_ptr<Region>)> f)
|
||||||
|
{
|
||||||
Glib::Threads::Mutex::Lock ls (region_map_lock);
|
Glib::Threads::Mutex::Lock ls (region_map_lock);
|
||||||
for (RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
for (RegionMap::const_iterator i = region_map.begin (); i != region_map.end (); ++i) {
|
||||||
f ( (*i).second );
|
f ((*i).second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int region_name (std::string&, std::string, bool new_level = false);
|
||||||
static int region_name (std::string &, std::string, bool new_level = false);
|
|
||||||
static std::string new_region_name (std::string);
|
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);
|
static std::string compound_region_name (const std::string& playlist, uint32_t compound_ops, uint32_t depth, bool whole_source);
|
||||||
|
|
||||||
|
@ -130,7 +133,11 @@ public:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef std::map<boost::shared_ptr<Region>, boost::shared_ptr<Region> > CompoundAssociations;
|
typedef std::map<boost::shared_ptr<Region>, boost::shared_ptr<Region> > CompoundAssociations;
|
||||||
static CompoundAssociations& compound_associations() { return _compound_associations; }
|
|
||||||
|
static CompoundAssociations& compound_associations ()
|
||||||
|
{
|
||||||
|
return _compound_associations;
|
||||||
|
}
|
||||||
|
|
||||||
static void add_compound_association (boost::shared_ptr<Region>, boost::shared_ptr<Region>);
|
static void add_compound_association (boost::shared_ptr<Region>, boost::shared_ptr<Region>);
|
||||||
|
|
||||||
|
@ -141,29 +148,28 @@ public:
|
||||||
|
|
||||||
static void map_add (boost::shared_ptr<Region>);
|
static void map_add (boost::shared_ptr<Region>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ::RegionNamingTest;
|
friend class ::RegionNamingTest;
|
||||||
|
|
||||||
static void region_changed (PBD::PropertyChange const &, boost::weak_ptr<Region>);
|
static void region_changed (PBD::PropertyChange const&, boost::weak_ptr<Region>);
|
||||||
|
static void add_to_region_name_maps (boost::shared_ptr<Region>);
|
||||||
|
static void rename_in_region_name_maps (boost::shared_ptr<Region>);
|
||||||
|
static void update_region_name_number_map (boost::shared_ptr<Region>);
|
||||||
|
static void remove_from_region_name_map (std::string);
|
||||||
|
|
||||||
static Glib::Threads::Mutex region_map_lock;
|
static Glib::Threads::Mutex region_map_lock;
|
||||||
|
static RegionMap region_map;
|
||||||
static RegionMap region_map;
|
|
||||||
|
|
||||||
static Glib::Threads::Mutex region_name_maps_mutex;
|
static Glib::Threads::Mutex region_name_maps_mutex;
|
||||||
/** map of partial region names and suffix numbers */
|
/** map of partial region names and suffix numbers */
|
||||||
static std::map<std::string, uint32_t> region_name_number_map;
|
static std::map<std::string, uint32_t> region_name_number_map;
|
||||||
/** map of complete region names with their region ID */
|
/** map of complete region names with their region ID */
|
||||||
static std::map<std::string, PBD::ID> region_name_map;
|
static std::map<std::string, PBD::ID> region_name_map;
|
||||||
static void add_to_region_name_maps (boost::shared_ptr<Region>);
|
|
||||||
static void rename_in_region_name_maps (boost::shared_ptr<Region>);
|
|
||||||
static void update_region_name_number_map (boost::shared_ptr<Region>);
|
|
||||||
static void remove_from_region_name_map (std::string);
|
|
||||||
|
|
||||||
static PBD::ScopedConnectionList* region_list_connections;
|
static PBD::ScopedConnectionList* region_list_connections;
|
||||||
static CompoundAssociations _compound_associations;
|
static CompoundAssociations _compound_associations;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace ARDOUR
|
||||||
|
|
||||||
#endif /* __ardour_region_factory_h__ */
|
#endif /* __ardour_region_factory_h__ */
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "ardour/region.h"
|
#include "ardour/region.h"
|
||||||
#include "ardour/region_factory.h"
|
#include "ardour/region_factory.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
#include "ardour/thawlist.h"
|
||||||
|
|
||||||
#include "pbd/i18n.h"
|
#include "pbd/i18n.h"
|
||||||
|
|
||||||
|
@ -41,40 +42,38 @@ using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
PBD::Signal1<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
|
PBD::Signal1<void, boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
|
||||||
Glib::Threads::Mutex RegionFactory::region_map_lock;
|
Glib::Threads::Mutex RegionFactory::region_map_lock;
|
||||||
RegionFactory::RegionMap RegionFactory::region_map;
|
RegionFactory::RegionMap RegionFactory::region_map;
|
||||||
PBD::ScopedConnectionList* RegionFactory::region_list_connections = 0;
|
PBD::ScopedConnectionList* RegionFactory::region_list_connections = 0;
|
||||||
Glib::Threads::Mutex RegionFactory::region_name_maps_mutex;
|
Glib::Threads::Mutex RegionFactory::region_name_maps_mutex;
|
||||||
std::map<std::string, uint32_t> RegionFactory::region_name_number_map;
|
std::map<std::string, uint32_t> RegionFactory::region_name_number_map;
|
||||||
std::map<std::string, PBD::ID> RegionFactory::region_name_map;
|
std::map<std::string, PBD::ID> RegionFactory::region_name_map;
|
||||||
RegionFactory::CompoundAssociations RegionFactory::_compound_associations;
|
RegionFactory::CompoundAssociations RegionFactory::_compound_associations;
|
||||||
|
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bool fork, ThawList* tl)
|
RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bool fork, ThawList* tl)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> ret;
|
boost::shared_ptr<Region> ret;
|
||||||
boost::shared_ptr<const AudioRegion> ar;
|
boost::shared_ptr<const AudioRegion> ar;
|
||||||
boost::shared_ptr<const MidiRegion> mr;
|
boost::shared_ptr<const MidiRegion> mr;
|
||||||
|
|
||||||
if ((ar = boost::dynamic_pointer_cast<const AudioRegion>(region)) != 0) {
|
|
||||||
|
|
||||||
|
if ((ar = boost::dynamic_pointer_cast<const AudioRegion> (region)) != 0) {
|
||||||
ret = boost::shared_ptr<Region> (new AudioRegion (ar, MusicSample (0, 0)));
|
ret = boost::shared_ptr<Region> (new AudioRegion (ar, MusicSample (0, 0)));
|
||||||
|
|
||||||
} else if ((mr = boost::dynamic_pointer_cast<const MidiRegion>(region)) != 0) {
|
} else if ((mr = boost::dynamic_pointer_cast<const MidiRegion> (region)) != 0) {
|
||||||
|
if (mr->session ().config.get_midi_copy_is_fork () || fork) {
|
||||||
if (mr->session().config.get_midi_copy_is_fork() || fork) {
|
|
||||||
/* What we really want to do here is what Editor::fork_region()
|
/* What we really want to do here is what Editor::fork_region()
|
||||||
does via Session::create_midi_source_by_stealing_name(), but we
|
does via Session::create_midi_source_by_stealing_name(), but we
|
||||||
don't have a Track. We'll just live with the skipped number,
|
don't have a Track. We'll just live with the skipped number,
|
||||||
and store the ancestral name of sources so multiple clones
|
and store the ancestral name of sources so multiple clones
|
||||||
generates reasonable names that don't have too many suffixes. */
|
generates reasonable names that don't have too many suffixes. */
|
||||||
const std::string ancestor_name = mr->sources().front()->ancestor_name();
|
const std::string ancestor_name = mr->sources ().front ()->ancestor_name ();
|
||||||
const std::string base = PBD::basename_nosuffix(ancestor_name);
|
const std::string base = PBD::basename_nosuffix (ancestor_name);
|
||||||
|
|
||||||
boost::shared_ptr<MidiSource> source = mr->session().create_midi_source_for_session(base);
|
boost::shared_ptr<MidiSource> source = mr->session ().create_midi_source_for_session (base);
|
||||||
source->set_ancestor_name(mr->sources().front()->name());
|
source->set_ancestor_name (mr->sources ().front ()->name ());
|
||||||
ret = mr->clone(source);
|
ret = mr->clone (source);
|
||||||
} else {
|
} else {
|
||||||
ret = boost::shared_ptr<Region> (new MidiRegion (mr, MusicSample (0, 0)));
|
ret = boost::shared_ptr<Region> (new MidiRegion (mr, MusicSample (0, 0)));
|
||||||
}
|
}
|
||||||
|
@ -82,7 +81,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
|
||||||
} else {
|
} else {
|
||||||
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
||||||
<< endmsg;
|
<< endmsg;
|
||||||
abort(); /*NOTREACHED*/
|
abort (); /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -91,9 +90,9 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
|
||||||
tl->add (ret);
|
tl->add (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->set_name (new_region_name(ret->name()));
|
ret->set_name (new_region_name (ret->name ()));
|
||||||
|
|
||||||
if (ret->session().config.get_glue_new_regions_to_bars_and_beats() && ret->position_lock_style() != MusicTime) {
|
if (ret->session ().config.get_glue_new_regions_to_bars_and_beats () && ret->position_lock_style () != MusicTime) {
|
||||||
ret->set_position_lock_style (MusicTime);
|
ret->set_position_lock_style (MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,23 +110,21 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& plist, bool announce, ThawList* tl)
|
RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& plist, bool announce, ThawList* tl)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> ret;
|
boost::shared_ptr<Region> ret;
|
||||||
boost::shared_ptr<const AudioRegion> other_a;
|
boost::shared_ptr<const AudioRegion> other_a;
|
||||||
boost::shared_ptr<const MidiRegion> other_m;
|
boost::shared_ptr<const MidiRegion> other_m;
|
||||||
|
|
||||||
if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
|
|
||||||
|
|
||||||
|
if ((other_a = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
|
||||||
ret = boost::shared_ptr<Region> (new AudioRegion (other_a));
|
ret = boost::shared_ptr<Region> (new AudioRegion (other_a));
|
||||||
|
|
||||||
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion>(region)) != 0) {
|
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion> (region)) != 0) {
|
||||||
|
|
||||||
ret = boost::shared_ptr<Region> (new MidiRegion (other_m));
|
ret = boost::shared_ptr<Region> (new MidiRegion (other_m));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
||||||
<< endmsg;
|
<< endmsg;
|
||||||
abort(); /*NOTREACHED*/
|
abort (); /*NOTREACHED*/
|
||||||
return boost::shared_ptr<Region>();
|
return boost::shared_ptr<Region> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -138,8 +135,8 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli
|
||||||
|
|
||||||
ret->apply_changes (plist);
|
ret->apply_changes (plist);
|
||||||
|
|
||||||
if (ret->session().config.get_glue_new_regions_to_bars_and_beats() && ret->position_lock_style() != MusicTime) {
|
if (ret->session ().config.get_glue_new_regions_to_bars_and_beats () && ret->position_lock_style () != MusicTime) {
|
||||||
ret->set_position_lock_style (MusicTime);
|
ret->set_position_lock_style (MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (announce) {
|
if (announce) {
|
||||||
|
@ -155,23 +152,21 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, const PropertyList& plist, bool announce, ThawList* tl)
|
RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, const PropertyList& plist, bool announce, ThawList* tl)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> ret;
|
boost::shared_ptr<Region> ret;
|
||||||
boost::shared_ptr<const AudioRegion> other_a;
|
boost::shared_ptr<const AudioRegion> other_a;
|
||||||
boost::shared_ptr<const MidiRegion> other_m;
|
boost::shared_ptr<const MidiRegion> other_m;
|
||||||
|
|
||||||
if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
|
|
||||||
|
|
||||||
|
if ((other_a = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
|
||||||
ret = boost::shared_ptr<Region> (new AudioRegion (other_a, offset));
|
ret = boost::shared_ptr<Region> (new AudioRegion (other_a, offset));
|
||||||
|
|
||||||
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion>(region)) != 0) {
|
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion> (region)) != 0) {
|
||||||
|
|
||||||
ret = boost::shared_ptr<Region> (new MidiRegion (other_m, offset));
|
ret = boost::shared_ptr<Region> (new MidiRegion (other_m, offset));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
||||||
<< endmsg;
|
<< endmsg;
|
||||||
abort(); /*NOTREACHED*/
|
abort (); /*NOTREACHED*/
|
||||||
return boost::shared_ptr<Region>();
|
return boost::shared_ptr<Region> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -181,7 +176,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, con
|
||||||
}
|
}
|
||||||
ret->apply_changes (plist);
|
ret->apply_changes (plist);
|
||||||
|
|
||||||
if (ret->session().config.get_glue_new_regions_to_bars_and_beats() && ret->position_lock_style() != MusicTime) {
|
if (ret->session ().config.get_glue_new_regions_to_bars_and_beats () && ret->position_lock_style () != MusicTime) {
|
||||||
ret->set_position_lock_style (MusicTime);
|
ret->set_position_lock_style (MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,15 +193,14 @@ RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, con
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs, const PropertyList& plist, bool announce, ThawList* tl)
|
RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs, const PropertyList& plist, bool announce, ThawList* tl)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> ret;
|
boost::shared_ptr<Region> ret;
|
||||||
boost::shared_ptr<const AudioRegion> other;
|
boost::shared_ptr<const AudioRegion> other;
|
||||||
|
|
||||||
/* used by AudioFilter when constructing a new region that is intended to have nearly
|
/* used by AudioFilter when constructing a new region that is intended to have nearly
|
||||||
identical settings to an original, but using different sources.
|
identical settings to an original, but using different sources.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((other = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
|
if ((other = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
|
||||||
|
|
||||||
// XXX use me in caller where plist is setup, this is start i think srcs.front()->length (srcs.front()->natural_position())
|
// XXX use me in caller where plist is setup, this is start i think srcs.front()->length (srcs.front()->natural_position())
|
||||||
|
|
||||||
ret = boost::shared_ptr<Region> (new AudioRegion (other, srcs));
|
ret = boost::shared_ptr<Region> (new AudioRegion (other, srcs));
|
||||||
|
@ -214,7 +208,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
|
||||||
} else {
|
} else {
|
||||||
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
|
||||||
<< endmsg;
|
<< endmsg;
|
||||||
abort(); /*NOTREACHED*/
|
abort (); /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -225,7 +219,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
|
||||||
|
|
||||||
ret->apply_changes (plist);
|
ret->apply_changes (plist);
|
||||||
|
|
||||||
if (ret->session().config.get_glue_new_regions_to_bars_and_beats() && ret->position_lock_style() != MusicTime) {
|
if (ret->session ().config.get_glue_new_regions_to_bars_and_beats () && ret->position_lock_style () != MusicTime) {
|
||||||
ret->set_position_lock_style (MusicTime);
|
ret->set_position_lock_style (MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,18 +244,15 @@ RegionFactory::create (boost::shared_ptr<Source> src, const PropertyList& plist,
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool announce, ThawList* tl)
|
RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool announce, ThawList* tl)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> ret;
|
boost::shared_ptr<Region> ret;
|
||||||
boost::shared_ptr<AudioSource> as;
|
boost::shared_ptr<AudioSource> as;
|
||||||
boost::shared_ptr<MidiSource> ms;
|
boost::shared_ptr<MidiSource> ms;
|
||||||
|
|
||||||
if ((as = boost::dynamic_pointer_cast<AudioSource>(srcs[0])) != 0) {
|
|
||||||
|
|
||||||
|
if ((as = boost::dynamic_pointer_cast<AudioSource> (srcs[0])) != 0) {
|
||||||
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
|
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
|
||||||
|
|
||||||
} else if ((ms = boost::dynamic_pointer_cast<MidiSource>(srcs[0])) != 0) {
|
} else if ((ms = boost::dynamic_pointer_cast<MidiSource> (srcs[0])) != 0) {
|
||||||
|
|
||||||
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
|
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -272,7 +263,7 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
|
||||||
|
|
||||||
ret->apply_changes (plist);
|
ret->apply_changes (plist);
|
||||||
|
|
||||||
if (ret->session().config.get_glue_new_regions_to_bars_and_beats() && ret->position_lock_style() != MusicTime) {
|
if (ret->session ().config.get_glue_new_regions_to_bars_and_beats () && ret->position_lock_style () != MusicTime) {
|
||||||
ret->set_position_lock_style (MusicTime);
|
ret->set_position_lock_style (MusicTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,18 +288,15 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> ret;
|
boost::shared_ptr<Region> ret;
|
||||||
|
|
||||||
if (srcs.empty()) {
|
if (srcs.empty ()) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (srcs[0]->type() == DataType::AUDIO) {
|
if (srcs[0]->type () == DataType::AUDIO) {
|
||||||
|
|
||||||
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
|
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
|
||||||
|
|
||||||
} else if (srcs[0]->type() == DataType::MIDI) {
|
} else if (srcs[0]->type () == DataType::MIDI) {
|
||||||
|
|
||||||
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
|
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -332,8 +320,8 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
|
||||||
void
|
void
|
||||||
RegionFactory::map_add (boost::shared_ptr<Region> r)
|
RegionFactory::map_add (boost::shared_ptr<Region> r)
|
||||||
{
|
{
|
||||||
pair<ID,boost::shared_ptr<Region> > p;
|
pair<ID, boost::shared_ptr<Region> > p;
|
||||||
p.first = r->id();
|
p.first = r->id ();
|
||||||
p.second = r;
|
p.second = r;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -360,9 +348,9 @@ RegionFactory::map_remove (boost::weak_ptr<Region> w)
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
||||||
RegionMap::iterator i = region_map.find (r->id());
|
RegionMap::iterator i = region_map.find (r->id ());
|
||||||
|
|
||||||
if (i != region_map.end()) {
|
if (i != region_map.end ()) {
|
||||||
remove_from_region_name_map (i->second->name ());
|
remove_from_region_name_map (i->second->name ());
|
||||||
region_map.erase (i);
|
region_map.erase (i);
|
||||||
}
|
}
|
||||||
|
@ -373,8 +361,8 @@ RegionFactory::region_by_id (const PBD::ID& id)
|
||||||
{
|
{
|
||||||
RegionMap::iterator i = region_map.find (id);
|
RegionMap::iterator i = region_map.find (id);
|
||||||
|
|
||||||
if (i == region_map.end()) {
|
if (i == region_map.end ()) {
|
||||||
return boost::shared_ptr<Region>();
|
return boost::shared_ptr<Region> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second;
|
return i->second;
|
||||||
|
@ -383,23 +371,23 @@ RegionFactory::region_by_id (const PBD::ID& id)
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::wholefile_region_by_name (const std::string& name)
|
RegionFactory::wholefile_region_by_name (const std::string& name)
|
||||||
{
|
{
|
||||||
for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
for (RegionMap::iterator i = region_map.begin (); i != region_map.end (); ++i) {
|
||||||
if (i->second->whole_file() && i->second->name() == name) {
|
if (i->second->whole_file () && i->second->name () == name) {
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return boost::shared_ptr<Region>();
|
return boost::shared_ptr<Region> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Region>
|
boost::shared_ptr<Region>
|
||||||
RegionFactory::region_by_name (const std::string& name)
|
RegionFactory::region_by_name (const std::string& name)
|
||||||
{
|
{
|
||||||
for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
for (RegionMap::iterator i = region_map.begin (); i != region_map.end (); ++i) {
|
||||||
if (i->second->name() == name) {
|
if (i->second->name () == name) {
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return boost::shared_ptr<Region>();
|
return boost::shared_ptr<Region> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -432,7 +420,7 @@ RegionFactory::delete_all_regions ()
|
||||||
clear_map ();
|
clear_map ();
|
||||||
|
|
||||||
/* tell everyone to drop references */
|
/* tell everyone to drop references */
|
||||||
for (RegionMap::iterator i = copy.begin(); i != copy.end(); ++i) {
|
for (RegionMap::iterator i = copy.begin (); i != copy.end (); ++i) {
|
||||||
i->second->drop_references ();
|
i->second->drop_references ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +443,7 @@ RegionFactory::add_to_region_name_maps (boost::shared_ptr<Region> region)
|
||||||
update_region_name_number_map (region);
|
update_region_name_number_map (region);
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
|
Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
|
||||||
region_name_map[region->name()] = region->id ();
|
region_name_map[region->name ()] = region->id ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Account for a region rename in the two region name maps */
|
/** Account for a region rename in the two region name maps */
|
||||||
|
@ -466,15 +454,15 @@ RegionFactory::rename_in_region_name_maps (boost::shared_ptr<Region> region)
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
|
Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
|
||||||
|
|
||||||
map<string, PBD::ID>::iterator i = region_name_map.begin();
|
map<string, PBD::ID>::iterator i = region_name_map.begin ();
|
||||||
while (i != region_name_map.end() && i->second != region->id ()) {
|
while (i != region_name_map.end () && i->second != region->id ()) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Erase the entry for the old name and put in a new one */
|
/* Erase the entry for the old name and put in a new one */
|
||||||
if (i != region_name_map.end()) {
|
if (i != region_name_map.end ()) {
|
||||||
region_name_map.erase (i);
|
region_name_map.erase (i);
|
||||||
region_name_map[region->name()] = region->id ();
|
region_name_map[region->name ()] = region->id ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,12 +480,11 @@ RegionFactory::remove_from_region_name_map (string n)
|
||||||
void
|
void
|
||||||
RegionFactory::update_region_name_number_map (boost::shared_ptr<Region> region)
|
RegionFactory::update_region_name_number_map (boost::shared_ptr<Region> region)
|
||||||
{
|
{
|
||||||
string::size_type const last_period = region->name().find_last_of ('.');
|
string::size_type const last_period = region->name ().find_last_of ('.');
|
||||||
|
|
||||||
if (last_period != string::npos && last_period < region->name().length() - 1) {
|
if (last_period != string::npos && last_period < region->name ().length () - 1) {
|
||||||
|
string const base = region->name ().substr (0, last_period);
|
||||||
string const base = region->name().substr (0, last_period);
|
string const number = region->name ().substr (last_period + 1);
|
||||||
string const number = region->name().substr (last_period + 1);
|
|
||||||
|
|
||||||
/* note that if there is no number, we get zero from atoi,
|
/* note that if there is no number, we get zero from atoi,
|
||||||
which is just fine
|
which is just fine
|
||||||
|
@ -509,7 +496,7 @@ RegionFactory::update_region_name_number_map (boost::shared_ptr<Region> region)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegionFactory::region_changed (PropertyChange const & what_changed, boost::weak_ptr<Region> w)
|
RegionFactory::region_changed (PropertyChange const& what_changed, boost::weak_ptr<Region> w)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Region> r = w.lock ();
|
boost::shared_ptr<Region> r = w.lock ();
|
||||||
if (!r) {
|
if (!r) {
|
||||||
|
@ -524,21 +511,19 @@ RegionFactory::region_changed (PropertyChange const & what_changed, boost::weak_
|
||||||
int
|
int
|
||||||
RegionFactory::region_name (string& result, string base, bool newlevel)
|
RegionFactory::region_name (string& result, string base, bool newlevel)
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
string subbase;
|
string subbase;
|
||||||
|
|
||||||
if (base.find("/") != string::npos) {
|
if (base.find ("/") != string::npos) {
|
||||||
base = base.substr(base.find_last_of("/") + 1);
|
base = base.substr (base.find_last_of ("/") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base == "") {
|
if (base == "") {
|
||||||
|
snprintf (buf, sizeof (buf), "%d", RegionFactory::nregions () + 1);
|
||||||
snprintf (buf, sizeof (buf), "%d", RegionFactory::nregions() + 1);
|
|
||||||
result = "region.";
|
result = "region.";
|
||||||
result += buf;
|
result += buf;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (newlevel) {
|
if (newlevel) {
|
||||||
subbase = base;
|
subbase = base;
|
||||||
} else {
|
} else {
|
||||||
|
@ -549,17 +534,16 @@ RegionFactory::region_name (string& result, string base, bool newlevel)
|
||||||
/* pos may be npos, but then we just use entire base */
|
/* pos may be npos, but then we just use entire base */
|
||||||
|
|
||||||
subbase = base.substr (0, pos);
|
subbase = base.substr (0, pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
|
Glib::Threads::Mutex::Lock lm (region_name_maps_mutex);
|
||||||
|
|
||||||
map<string,uint32_t>::iterator x;
|
map<string, uint32_t>::iterator x;
|
||||||
|
|
||||||
result = subbase;
|
result = subbase;
|
||||||
|
|
||||||
if ((x = region_name_number_map.find (subbase)) == region_name_number_map.end()) {
|
if ((x = region_name_number_map.find (subbase)) == region_name_number_map.end ()) {
|
||||||
result += ".1";
|
result += ".1";
|
||||||
region_name_number_map[subbase] = 1;
|
region_name_number_map[subbase] = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -578,9 +562,9 @@ string
|
||||||
RegionFactory::compound_region_name (const string& playlist, uint32_t compound_ops, uint32_t depth, bool whole_source)
|
RegionFactory::compound_region_name (const string& playlist, uint32_t compound_ops, uint32_t depth, bool whole_source)
|
||||||
{
|
{
|
||||||
if (whole_source) {
|
if (whole_source) {
|
||||||
return string_compose (_("%1 compound-%2 (%3)"), playlist, compound_ops+1, depth+1);
|
return string_compose (_("%1 compound-%2 (%3)"), playlist, compound_ops + 1, depth + 1);
|
||||||
} else {
|
} else {
|
||||||
return string_compose (_("%1 compound-%2.1 (%3)"), playlist, compound_ops+1, depth+1);
|
return string_compose (_("%1 compound-%2.1 (%3)"), playlist, compound_ops + 1, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,24 +572,21 @@ string
|
||||||
RegionFactory::new_region_name (string old)
|
RegionFactory::new_region_name (string old)
|
||||||
{
|
{
|
||||||
string::size_type last_period;
|
string::size_type last_period;
|
||||||
uint32_t number;
|
uint32_t number;
|
||||||
string::size_type len = old.length() + 64;
|
string::size_type len = old.length () + 64;
|
||||||
string remainder;
|
string remainder;
|
||||||
std::vector<char> buf(len);
|
std::vector<char> buf (len);
|
||||||
|
|
||||||
if ((last_period = old.find_last_of ('.')) == string::npos) {
|
if ((last_period = old.find_last_of ('.')) == string::npos) {
|
||||||
|
|
||||||
/* no period present - add one explicitly */
|
/* no period present - add one explicitly */
|
||||||
|
|
||||||
old += '.';
|
old += '.';
|
||||||
last_period = old.length() - 1;
|
last_period = old.length () - 1;
|
||||||
number = 0;
|
number = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if (last_period < old.length () - 1) {
|
||||||
if (last_period < old.length() - 1) {
|
string period_to_end = old.substr (last_period + 1);
|
||||||
|
|
||||||
string period_to_end = old.substr (last_period+1);
|
|
||||||
|
|
||||||
/* extra material after the period */
|
/* extra material after the period */
|
||||||
|
|
||||||
|
@ -613,24 +594,23 @@ RegionFactory::new_region_name (string old)
|
||||||
|
|
||||||
number = atoi (period_to_end);
|
number = atoi (period_to_end);
|
||||||
|
|
||||||
if (numerals_end < period_to_end.length() - 1) {
|
if (numerals_end < period_to_end.length () - 1) {
|
||||||
/* extra material after the end of the digits */
|
/* extra material after the end of the digits */
|
||||||
remainder = period_to_end.substr (numerals_end);
|
remainder = period_to_end.substr (numerals_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
last_period = old.length();
|
last_period = old.length ();
|
||||||
number = 0;
|
number = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (number < (UINT_MAX-1)) {
|
while (number < (UINT_MAX - 1)) {
|
||||||
|
|
||||||
string sbuf;
|
string sbuf;
|
||||||
|
|
||||||
number++;
|
number++;
|
||||||
|
|
||||||
snprintf (&buf[0], len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str());
|
snprintf (&buf[0], len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str (), number, remainder.c_str ());
|
||||||
sbuf = &buf[0];
|
sbuf = &buf[0];
|
||||||
|
|
||||||
if (region_name_map.find (sbuf) == region_name_map.end ()) {
|
if (region_name_map.find (sbuf) == region_name_map.end ()) {
|
||||||
|
@ -638,7 +618,7 @@ RegionFactory::new_region_name (string old)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number != (UINT_MAX-1)) {
|
if (number != (UINT_MAX - 1)) {
|
||||||
return &buf[0];
|
return &buf[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,13 +631,13 @@ RegionFactory::get_whole_region_for_source (boost::shared_ptr<Source> s)
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
||||||
|
|
||||||
for (RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
for (RegionMap::const_iterator i = region_map.begin (); i != region_map.end (); ++i) {
|
||||||
if (i->second->uses_source (s) && i->second->whole_file()) {
|
if (i->second->uses_source (s) && i->second->whole_file ()) {
|
||||||
return (i->second);
|
return (i->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::shared_ptr<Region>();
|
return boost::shared_ptr<Region> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -665,7 +645,7 @@ RegionFactory::get_regions_using_source (boost::shared_ptr<Source> s, std::set<b
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
||||||
|
|
||||||
for (RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
for (RegionMap::const_iterator i = region_map.begin (); i != region_map.end (); ++i) {
|
||||||
if (i->second->uses_source (s)) {
|
if (i->second->uses_source (s)) {
|
||||||
r.insert (i->second);
|
r.insert (i->second);
|
||||||
}
|
}
|
||||||
|
@ -676,8 +656,8 @@ void
|
||||||
RegionFactory::remove_regions_using_source (boost::shared_ptr<Source> src)
|
RegionFactory::remove_regions_using_source (boost::shared_ptr<Source> src)
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
Glib::Threads::Mutex::Lock lm (region_map_lock);
|
||||||
RegionList remove_regions;
|
RegionList remove_regions;
|
||||||
for (RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
for (RegionMap::const_iterator i = region_map.begin (); i != region_map.end (); ++i) {
|
||||||
if (i->second->uses_source (src)) {
|
if (i->second->uses_source (src)) {
|
||||||
remove_regions.push_back (i->second);
|
remove_regions.push_back (i->second);
|
||||||
}
|
}
|
||||||
|
@ -685,7 +665,7 @@ RegionFactory::remove_regions_using_source (boost::shared_ptr<Source> src)
|
||||||
lm.release ();
|
lm.release ();
|
||||||
|
|
||||||
/* this will call RegionFactory::map_remove () */
|
/* this will call RegionFactory::map_remove () */
|
||||||
for (RegionList::iterator i = remove_regions.begin(); i != remove_regions.end(); ++i) {
|
for (RegionList::iterator i = remove_regions.begin (); i != remove_regions.end (); ++i) {
|
||||||
(*i)->drop_references ();
|
(*i)->drop_references ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user