mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Copy region properties (1/2)
RegionFactory::create(Region&,..) copies all region properties. There are however various operations that use a new Source as intermediate to create a new Region from another Region. Those operations should also inherit various region properties (such as mute, opaque, locked, ..)
This commit is contained in:
parent
b5fd753886
commit
8b0ab38675
5 changed files with 10 additions and 36 deletions
|
|
@ -1388,12 +1388,9 @@ AudioRegion::separate_by_channel (vector<boost::shared_ptr<Region> >& v) const
|
||||||
"whole file" even if it covers the entire source file(s).
|
"whole file" even if it covers the entire source file(s).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PropertyList plist;
|
PropertyList plist (properties ());
|
||||||
|
|
||||||
plist.add (Properties::start, _start.val());
|
|
||||||
plist.add (Properties::length, _length.val());
|
|
||||||
plist.add (Properties::name, new_name);
|
plist.add (Properties::name, new_name);
|
||||||
plist.add (Properties::layer, layer ());
|
|
||||||
plist.add (Properties::whole_file, true);
|
plist.add (Properties::whole_file, true);
|
||||||
|
|
||||||
v.push_back(RegionFactory::create (srcs, plist));
|
v.push_back(RegionFactory::create (srcs, plist));
|
||||||
|
|
|
||||||
|
|
@ -133,26 +133,13 @@ Filter::finish (boost::shared_ptr<Region> region, SourceList& nsrcs, string regi
|
||||||
}
|
}
|
||||||
results.clear ();
|
results.clear ();
|
||||||
|
|
||||||
PropertyList plist;
|
PropertyList plist (region->properties ());
|
||||||
|
|
||||||
plist.add (Properties::start, std::numeric_limits<timecnt_t>::min());
|
plist.add (Properties::start, std::numeric_limits<timecnt_t>::min());
|
||||||
plist.add (Properties::length, region->length());
|
|
||||||
plist.add (Properties::name, region_name);
|
plist.add (Properties::name, region_name);
|
||||||
plist.add (Properties::whole_file, true);
|
plist.add (Properties::whole_file, true);
|
||||||
|
|
||||||
boost::shared_ptr<Region> r = RegionFactory::create (nsrcs, plist);
|
boost::shared_ptr<Region> r = RegionFactory::create (nsrcs, plist);
|
||||||
|
|
||||||
boost::shared_ptr<AudioRegion> audio_region = boost::dynamic_pointer_cast<AudioRegion> (region);
|
|
||||||
boost::shared_ptr<AudioRegion> audio_r = boost::dynamic_pointer_cast<AudioRegion> (r);
|
|
||||||
if (audio_region && audio_r) {
|
|
||||||
audio_r->set_position (region->position());
|
|
||||||
audio_r->set_scale_amplitude (audio_region->scale_amplitude());
|
|
||||||
audio_r->set_fade_in_active (audio_region->fade_in_active ());
|
|
||||||
audio_r->set_fade_in (audio_region->fade_in ());
|
|
||||||
audio_r->set_fade_out_active (audio_region->fade_out_active ());
|
|
||||||
audio_r->set_fade_out (audio_region->fade_out ());
|
|
||||||
*(audio_r->envelope()) = *(audio_region->envelope ());
|
|
||||||
}
|
|
||||||
results.push_back (r);
|
results.push_back (r);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ remove_file_source (boost::shared_ptr<Source> source)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::deinterlace_midi_region ( boost::shared_ptr<MidiRegion> mr )
|
Session::deinterlace_midi_region (boost::shared_ptr<MidiRegion> mr)
|
||||||
{
|
{
|
||||||
typedef vector<boost::shared_ptr<Source> > Sources;
|
typedef vector<boost::shared_ptr<Source> > Sources;
|
||||||
Sources newfiles;
|
Sources newfiles;
|
||||||
|
|
@ -580,12 +580,10 @@ Session::deinterlace_midi_region ( boost::shared_ptr<MidiRegion> mr )
|
||||||
add_source(*x);
|
add_source(*x);
|
||||||
|
|
||||||
/* create a whole-file region for this new source, so it shows up in the Source List...*/
|
/* create a whole-file region for this new source, so it shows up in the Source List...*/
|
||||||
PropertyList plist;
|
PropertyList plist (mr->properties ());
|
||||||
plist.add (Properties::whole_file, true);
|
plist.add (Properties::whole_file, true);
|
||||||
plist.add (Properties::start, mr->start());
|
|
||||||
plist.add (Properties::length, mr->length());
|
|
||||||
plist.add (Properties::name, (*x)->name());
|
plist.add (Properties::name, (*x)->name());
|
||||||
plist.add (Properties::tags, "(split-chans)");
|
plist.add (Properties::tags, string_compose ("%1%2%3", _("split-chans)"), mr->tags ().empty() ? "" : " ", mr->tags ()));
|
||||||
boost::shared_ptr<Region> whole = RegionFactory::create (*x, plist);
|
boost::shared_ptr<Region> whole = RegionFactory::create (*x, plist);
|
||||||
|
|
||||||
/* ... and insert a discrete copy into the playlist*/
|
/* ... and insert a discrete copy into the playlist*/
|
||||||
|
|
|
||||||
|
|
@ -1226,7 +1226,7 @@ LuaAPI::Rubberband::finalize ()
|
||||||
/* create a new region */
|
/* create a new region */
|
||||||
std::string region_name = RegionFactory::new_region_name (_region->name ());
|
std::string region_name = RegionFactory::new_region_name (_region->name ());
|
||||||
|
|
||||||
PropertyList plist;
|
PropertyList plist (_region->properties ());
|
||||||
plist.add (Properties::start, 0);
|
plist.add (Properties::start, 0);
|
||||||
plist.add (Properties::length, _region->length_samples ());
|
plist.add (Properties::length, _region->length_samples ());
|
||||||
plist.add (Properties::name, region_name);
|
plist.add (Properties::name, region_name);
|
||||||
|
|
@ -1235,16 +1235,7 @@ LuaAPI::Rubberband::finalize ()
|
||||||
boost::shared_ptr<Region> r = RegionFactory::create (sl, plist);
|
boost::shared_ptr<Region> r = RegionFactory::create (sl, plist);
|
||||||
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
|
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
|
||||||
|
|
||||||
ar->set_scale_amplitude (_region->scale_amplitude ());
|
|
||||||
ar->set_fade_in_active (_region->fade_in_active ());
|
|
||||||
ar->set_fade_in (_region->fade_in ());
|
|
||||||
ar->set_fade_out_active (_region->fade_out_active ());
|
|
||||||
ar->set_fade_out (_region->fade_out ());
|
|
||||||
*(ar->envelope ()) = *(_region->envelope ());
|
|
||||||
|
|
||||||
ar->set_ancestral_data (timepos_t (_read_start), timecnt_t (_read_len), _stretch_ratio, _pitch_ratio);
|
ar->set_ancestral_data (timepos_t (_read_start), timecnt_t (_read_len), _stretch_ratio, _pitch_ratio);
|
||||||
ar->set_master_sources (_region->master_sources ());
|
|
||||||
ar->set_position (timepos_t (_region->position_sample ()));
|
|
||||||
ar->set_length (ar->length ().scale (_stretch_ratio)); // XXX
|
ar->set_length (ar->length ().scale (_stretch_ratio)); // XXX
|
||||||
if (_stretch_ratio != 1.0) {
|
if (_stretch_ratio != 1.0) {
|
||||||
// TODO: apply mapping
|
// TODO: apply mapping
|
||||||
|
|
|
||||||
|
|
@ -161,12 +161,13 @@ MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc, ThawList* tl) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyList plist;
|
PropertyList plist (properties ());
|
||||||
|
|
||||||
plist.add (Properties::name, PBD::basename_nosuffix (newsrc->name()));
|
plist.add (Properties::name, PBD::basename_nosuffix (newsrc->name()));
|
||||||
plist.add (Properties::whole_file, true);
|
plist.add (Properties::whole_file, true);
|
||||||
plist.add (Properties::start, _start);
|
plist.add (Properties::automatic, false);
|
||||||
plist.add (Properties::length, _length);
|
plist.add (Properties::external, false);
|
||||||
|
plist.add (Properties::import, false);
|
||||||
plist.add (Properties::layer, 0);
|
plist.add (Properties::layer, 0);
|
||||||
|
|
||||||
boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true, tl)));
|
boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true, tl)));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue