summaryrefslogtreecommitdiff
path: root/libs/ardour/region_factory.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-21 17:03:16 +0000
committerDavid Robillard <d@drobilla.net>2010-12-21 17:03:16 +0000
commitda89cd0c9b545c418fe2d6692844ff05779bb258 (patch)
tree6471696f49b6fedb07159bbf6e1389c0e48d0011 /libs/ardour/region_factory.cc
parent71986da212b641b53c4583d0dca02cc87c758291 (diff)
Remove confuzzling offset_relative stuff from region construction (pre-properties "hangover").
This commit (in theory) only reorganizes code, not change actual functionality. RegionFactory now uses a distinct Region constructor for each case, which is a bit easier to wrap around. Note comment at region.cc:276, this case seems pretty weird to me (more hangover?). git-svn-id: svn://localhost/ardour2/branches/3.0@8320 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/region_factory.cc')
-rw-r--r--libs/ardour/region_factory.cc50
1 files changed, 38 insertions, 12 deletions
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index 459f993676..4179ec95db 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -53,7 +53,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce)
if ((ar = boost::dynamic_pointer_cast<const AudioRegion>(region)) != 0) {
- AudioRegion* arn = new AudioRegion (ar, 0, true);
+ AudioRegion* arn = new AudioRegion (ar, 0);
boost_debug_shared_ptr_mark_interesting (arn, "Region");
boost::shared_ptr<AudioRegion> arp (arn);
@@ -61,7 +61,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce)
} else if ((mr = boost::dynamic_pointer_cast<const MidiRegion>(region)) != 0) {
- MidiRegion* mrn = new MidiRegion (mr, 0, true);
+ MidiRegion* mrn = new MidiRegion (mr, 0);
boost::shared_ptr<MidiRegion> mrp (mrn);
ret = boost::static_pointer_cast<Region> (mrp);
@@ -87,19 +87,45 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce)
}
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, const PropertyList& plist, bool announce)
-{
- return create (region, offset, true, plist, announce);
-}
-
-boost::shared_ptr<Region>
RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& plist, bool announce)
{
- return create (region, 0, false, plist, announce);
+ boost::shared_ptr<Region> ret;
+ boost::shared_ptr<const AudioRegion> other_a;
+ boost::shared_ptr<const MidiRegion> other_m;
+
+ if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
+
+ AudioRegion* ar = new AudioRegion (other_a);
+ boost::shared_ptr<AudioRegion> arp (ar);
+ ret = boost::static_pointer_cast<Region> (arp);
+
+ } else if ((other_m = boost::dynamic_pointer_cast<MidiRegion>(region)) != 0) {
+
+ MidiRegion* mr = new MidiRegion (other_m);
+ boost::shared_ptr<MidiRegion> mrp (mr);
+ ret = boost::static_pointer_cast<Region> (mrp);
+
+ } else {
+ fatal << _("programming error: RegionFactory::create() called with unknown Region type")
+ << endmsg;
+ /*NOTREACHED*/
+ return boost::shared_ptr<Region>();
+ }
+
+ if (ret) {
+ ret->apply_changes (plist);
+ map_add (ret);
+
+ if (announce) {
+ CheckNewRegion (ret);
+ }
+ }
+
+ return ret;
}
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, bool offset_relative, const PropertyList& plist, bool announce)
+RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, const PropertyList& plist, bool announce)
{
boost::shared_ptr<Region> ret;
boost::shared_ptr<const AudioRegion> other_a;
@@ -107,7 +133,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, b
if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
- AudioRegion* ar = new AudioRegion (other_a, offset, offset_relative);
+ AudioRegion* ar = new AudioRegion (other_a, offset);
boost_debug_shared_ptr_mark_interesting (ar, "Region");
boost::shared_ptr<AudioRegion> arp (ar);
@@ -115,7 +141,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, b
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion>(region)) != 0) {
- MidiRegion* mr = new MidiRegion (other_m, offset, offset_relative);
+ MidiRegion* mr = new MidiRegion (other_m, offset);
boost::shared_ptr<MidiRegion> mrp (mr);
ret = boost::static_pointer_cast<Region> (mrp);