using namespace ARDOUR;
using namespace PBD;
+using namespace std;
PBD::Signal1<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
Glib::StaticMutex RegionFactory::region_map_lock;
} else if ((mr = boost::dynamic_pointer_cast<const MidiRegion>(region)) != 0) {
- ret = boost::shared_ptr<Region> (new MidiRegion (mr, 0));
+ if (mr->session().config.get_midi_copy_is_fork()) {
+ ret = mr->clone ();
+ } else {
+ ret = boost::shared_ptr<Region> (new MidiRegion (mr, 0));
+ }
} else {
fatal << _("programming error: RegionFactory::create() called with unknown Region type")
}
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
+ // boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
#endif
return ret;
}
}
}
-#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+ // boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
#endif
return ret;
}
if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
ret = boost::shared_ptr<Region> (new AudioRegion (other_a, offset));
-
+
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion>(region)) != 0) {
ret = boost::shared_ptr<Region> (new MidiRegion (other_m, offset));
}
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
+ // boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
#endif
return ret;
}
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()->timeline_position())
-
+
ret = boost::shared_ptr<Region> (new AudioRegion (other, srcs));
} else {
}
}
-#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+ // boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
#endif
return ret;
}
boost::shared_ptr<Region>
RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool announce)
{
- boost::shared_ptr<Region> ret;
+ boost::shared_ptr<Region> ret;
boost::shared_ptr<AudioSource> as;
boost::shared_ptr<MidiSource> ms;
}
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
+ // boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
#endif
return ret;
}
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
} else if (srcs[0]->type() == DataType::MIDI) {
-
+
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
}
}
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
- boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
+ // boost_debug_shared_ptr_mark_interesting (ret.get(), "Region");
#endif
return ret;
}
p.first = r->id();
p.second = r;
- {
+ {
Glib::Mutex::Lock lm (region_map_lock);
region_map.insert (p);
}
region_map.erase (i);
} else if (r == i->second) {
region_map.erase (i);
- }
+ }
i = tmp;
}
}
}
return boost::shared_ptr<Region>();
-}
+}
boost::shared_ptr<Region>
RegionFactory::region_by_name (const std::string& name)
}
}
return boost::shared_ptr<Region>();
-}
+}
void
RegionFactory::clear_map ()
vanish as we leave this scope, thus calling all destructors.
*/
}
-
+
uint32_t
RegionFactory::nregions ()
{
char buf[len];
if ((last_period = old.find_last_of ('.')) == string::npos) {
-
+
/* no period present - add one explicitly */
-
+
old += '.';
last_period = old.length() - 1;
number = 0;
-
+
} else {
-
+
if (last_period < old.length() - 1) {
string period_to_end = old.substr (last_period+1);
-
+
/* extra material after the period */
string::size_type numerals_end = period_to_end.find_first_not_of ("0123456789");
-
+
number = atoi (period_to_end);
-
+
if (numerals_end < period_to_end.length() - 1) {
/* extra material after the end of the digits */
remainder = period_to_end.substr (numerals_end);
}
while (number < (UINT_MAX-1)) {
-
+
const RegionMap& regions (RegionFactory::regions());
RegionMap::const_iterator i;
string sbuf;
return old;
}
-void
+void
RegionFactory::get_regions_using_source (boost::shared_ptr<Source> s, std::set<boost::shared_ptr<Region> >& r)
{
Glib::Mutex::Lock lm (region_map_lock);
}
}
-void
+void
RegionFactory::remove_regions_using_source (boost::shared_ptr<Source> src)
{
Glib::Mutex::Lock lm (region_map_lock);