attempt to follow time domain changes in playlists when tracks change
This commit is contained in:
parent
1fce815e2d
commit
4cdac29029
@ -3516,6 +3516,16 @@ Playlist::globally_change_time_domain (Temporal::TimeDomain from, Temporal::Time
|
||||
void
|
||||
Playlist::time_domain_changed ()
|
||||
{
|
||||
using namespace Temporal;
|
||||
|
||||
TimeDomainProvider::time_domain_changed ();
|
||||
|
||||
Temporal::TimeDomain to = time_domain();
|
||||
Temporal::TimeDomain from = (to == AudioTime ? BeatTime : AudioTime);
|
||||
|
||||
for (auto & region : regions) {
|
||||
region->change_time_domain (from, to);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -2205,3 +2205,12 @@ Region::globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDo
|
||||
std::cerr << "new domain after GCTD " << _length.val() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Region::change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to)
|
||||
{
|
||||
if (_length.val().time_domain() == from) {
|
||||
timecnt_t& l (_length.non_const_val());
|
||||
l.set_time_domain (to);
|
||||
}
|
||||
}
|
||||
|
@ -712,12 +712,29 @@ Track::use_playlist (DataType dt, std::shared_ptr<Playlist> p, bool set_orig)
|
||||
if (rl->size () > 0) {
|
||||
Region::RegionsPropertyChanged (rl, Properties::hidden);
|
||||
}
|
||||
/* we don't know for certain that we controlled the old
|
||||
* playlist's time domain, but it's a pretty good guess. If it
|
||||
* has an actual parent, revert to using its parent's domain
|
||||
*/
|
||||
if (old->time_domain_parent()) {
|
||||
old->clear_time_domain ();
|
||||
}
|
||||
}
|
||||
|
||||
if (p) {
|
||||
std::shared_ptr<RegionList> rl (new RegionList (p->region_list_property ().rlist ()));
|
||||
if (rl->size () > 0) {
|
||||
Region::RegionsPropertyChanged (rl, Properties::hidden);
|
||||
}
|
||||
|
||||
/* If the playlist has no time domain parent or its parent is
|
||||
* the session, reset to the explicit time domain of this
|
||||
* track.
|
||||
*/
|
||||
|
||||
if (!p->time_domain_parent() || p->time_domain_parent() == &_session) {
|
||||
p->set_time_domain (time_domain());
|
||||
}
|
||||
}
|
||||
|
||||
_session.set_dirty ();
|
||||
|
Loading…
Reference in New Issue
Block a user