13
0

more functional tempo mapping

This commit is contained in:
Paul Davis 2023-02-24 16:50:51 -07:00
parent 21074b189a
commit 45490bf43f
6 changed files with 25 additions and 1 deletions

View File

@ -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:
*

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -111,6 +111,10 @@ public:
return _current;
}
T& non_const_val () {
return _current;
}
/* MANAGEMENT OF Stateful State */
bool set_value (XMLNode const & node) {

View File

@ -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);
}