diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index b0d463c1b6..214e63e991 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -111,6 +111,7 @@ public: const DataType& data_type () const { return _type; } Temporal::TimeDomain time_domain() const; + void globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to); /** How the region parameters play together: * diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 8732d7d58e..7195fcba71 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -775,6 +775,8 @@ Location::globally_change_time_domain (Temporal::TimeDomain from, Temporal::Time domain_swap->add (_start); domain_swap->add (_end); + } else { + std::cerr << name() << " wrong domain: " << _start << " .. " << _end << std::endl; } } @@ -1735,6 +1737,7 @@ Locations::clear_cue_markers (samplepos_t start, samplepos_t end) void Locations::globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to) { + std::cerr << "L-gctd on " << locations.size() << std::endl; Glib::Threads::RWLock::WriterLock lm (_lock); for (auto & l : locations) { l->globally_change_time_domain (from, to); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index f7c3606e32..445caedbbe 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -3510,4 +3510,8 @@ Playlist::time_domain() const void Playlist::globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to) { + RegionReadLock rlock (this); + for (auto & region : regions) { + region->globally_change_time_domain (from, to); + } } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 241ca249b1..325dadf242 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -2171,3 +2171,15 @@ Region::time_domain() const return Temporal::BeatTime; } + +void +Region::globally_change_time_domain (Temporal::TimeDomain from, Temporal::TimeDomain to) +{ + assert (Temporal::domain_swap); + + if (_length.val().time_domain() == from) { + timecnt_t& l (_length.non_const_val()); + l.set_time_domain (to); + Temporal::domain_swap->add (l); + } +} diff --git a/libs/pbd/pbd/properties.h b/libs/pbd/pbd/properties.h index f4db3b0eb8..8ee2ab0c3b 100644 --- a/libs/pbd/pbd/properties.h +++ b/libs/pbd/pbd/properties.h @@ -111,6 +111,10 @@ public: return _current; } + T& non_const_val () { + return _current; + } + /* MANAGEMENT OF Stateful State */ bool set_value (XMLNode const & node) { diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 6dd8ec03c8..618a09d465 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -843,7 +843,6 @@ TempoMap::add_meter (MeterPoint* mp) void TempoMap::change_tempo (TempoPoint & p, Tempo const & t) { - std::cerr << "overwrite " << ((Tempo*)&p)->note_types_per_minute() << " with " << t.note_types_per_minute() << std::endl; *((Tempo*)&p) = t; reset_starting_at (p.sclock()); } @@ -4156,6 +4155,7 @@ DomainSwapInformation::clear () void DomainSwapInformation::undo () { + std::cerr << "DSI::undo on " << counts.size() << " lengths and " << positions.size() << " positions\n"; for (auto & c : counts) { c->set_time_domain (previous); }