temporal: the second variant of shift() (untested)

This commit is contained in:
Paul Davis 2023-06-06 15:49:36 -06:00
parent e6b6340f3e
commit d761ccb59b
2 changed files with 15 additions and 21 deletions

View File

@ -945,8 +945,7 @@ void
TempoMap::paste (TempoMapCutBuffer const & cb, timepos_t const & position, bool ripple)
{
if (ripple) {
shift (position, cb.duration());
}
bool replaced_ignored;
@ -1010,30 +1009,24 @@ TempoMap::paste (TempoMapCutBuffer const & cb, timepos_t const & position, bool
}
#if 0
void
TempoMap::shift (timepos_t const & at, timecnt_t const & by)
{
if (by.time_domain() == BeatTime) {
superclock_t distance = by.superclocks ();
superclock_t at_superclocks = by.superclocks ();
Points::iterator p = _points.begin();
} else {
superclock_t distance = by.superclocks ();
superclock_t at_superclocks = by.superclocks ();
Points::iterator p = _points.begin();
while (p.sclock() < at_superclocks) {
++p;
}
if (p == _points.end()) {
return;
}
p->set (at_superclocks + distance, p->beats(), p->bbt());
reset_starting_at (at_superclocks);
while (p->sclock() < at_superclocks) {
++p;
}
if (p == _points.end()) {
return;
}
p->set (at_superclocks + distance, p->beats(), p->bbt());
reset_starting_at (at_superclocks);
}
#endif
void
TempoMap::shift (timepos_t const & at, BBT_Offset const & offset)

View File

@ -822,7 +822,8 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
LIBTEMPORAL_API TempoMapCutBuffer* copy (timepos_t const & start, timepos_t const & end);
LIBTEMPORAL_API void paste (TempoMapCutBuffer const &, timepos_t const & position, bool ripple);
LIBTEMPORAL_API void shift (timepos_t const & at, BBT_Offset const &);
LIBTEMPORAL_API void shift (timepos_t const & at, BBT_Offset const & by);
LIBTEMPORAL_API void shift (timepos_t const & at, timecnt_t const & by);
private:
template<typename TimeType, typename Comparator> TempoPoint const & _tempo_at (TimeType when, Comparator cmp) const {