13
0

Revert "libtemporal: the TempoMap::_points list serves no purpose, so remove it"

This reverts commit edc93fc62b6a36949b3cc37aee333904bc6b97f0.
This commit is contained in:
Paul Davis 2021-02-07 10:48:15 -07:00
parent d6d0eb0d9e
commit b43eca15b0
2 changed files with 22 additions and 0 deletions

View File

@ -633,6 +633,10 @@ TempoMap::TempoMap (Tempo const & initial_tempo, Meter const & initial_meter)
_tempos.push_back (*tp);
_meters.push_back (*mp);
_bartimes.push_back (*mtp);
_points.push_back (*tp);
_points.push_back (*mp);
_points.push_back (*mtp);
}
TempoMap::~TempoMap()
@ -661,19 +665,32 @@ TempoMap::operator= (TempoMap const & other)
void
TempoMap::copy_points (TempoMap const & other)
{
std::vector<Point*> p;
p.reserve (other._meters.size() + other._tempos.size() + other._bartimes.size());
for (Meters::const_iterator m = other._meters.begin(); m != other._meters.end(); ++m) {
MeterPoint* mp = new MeterPoint (*m);
_meters.push_back (*mp);
p.push_back (mp);
}
for (Tempos::const_iterator t = other._tempos.begin(); t != other._tempos.end(); ++t) {
TempoPoint* tp = new TempoPoint (*t);
_tempos.push_back (*tp);
p.push_back (tp);
}
for (MusicTimes::const_iterator mt = other._bartimes.begin(); mt != other._bartimes.end(); ++mt) {
MusicTimePoint* mtp = new MusicTimePoint (*mt);
_bartimes.push_back (*mtp);
p.push_back (mtp);
}
sort (p.begin(), p.end(), Point::ptr_sclock_comparator());
for (std::vector<Point*>::iterator pi = p.begin(); pi != p.end(); ++pi) {
_points.push_back (**pi);
}
}

View File

@ -119,6 +119,8 @@ class LIBTEMPORAL_API Point {
TempoMap const & map() const { return *_map; }
boost::intrusive::list_member_hook<> _point_hook;
protected:
superclock_t _sclock;
Beats _quarters;
@ -815,10 +817,12 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
typedef boost::intrusive::member_hook<TempoPoint,boost::intrusive::list_member_hook<>, &TempoPoint::_tempo_hook> TempoHookOption;
typedef boost::intrusive::member_hook<MeterPoint,boost::intrusive::list_member_hook<>, &MeterPoint::_meter_hook> MeterHookOption;
typedef boost::intrusive::member_hook<MusicTimePoint,boost::intrusive::list_member_hook<>, &MusicTimePoint::_bartime_hook> BarTimeHookOption;
typedef boost::intrusive::member_hook<Point,boost::intrusive::list_member_hook<>, &Point::_point_hook> PointHookOption;
typedef boost::intrusive::list<TempoPoint,TempoHookOption> Tempos;
typedef boost::intrusive::list<MeterPoint,MeterHookOption> Meters;
typedef boost::intrusive::list<MusicTimePoint,BarTimeHookOption> MusicTimes;
typedef boost::intrusive::list<Point,PointHookOption> Points;
Beats quarters_at_sample (samplepos_t sc) const { return quarters_at_superclock (samples_to_superclock (sc, TEMPORAL_SAMPLE_RATE)); }
Beats quarters_at_superclock (superclock_t sc) const;
@ -827,6 +831,7 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
Tempos _tempos;
Meters _meters;
MusicTimes _bartimes;
Points _points;
TimeDomain _time_domain;