temporal: a basic data structure to hold the result of a TempoMap cut/copy operation
This commit is contained in:
parent
6572b8d409
commit
b3040a31fc
|
@ -4510,3 +4510,54 @@ DomainSwapInformation::undo ()
|
|||
|
||||
clear ();
|
||||
}
|
||||
|
||||
TempoMapCutBuffer::TempoMapCutBuffer (timecnt_t const & dur, TempoMetric const & start, TempoMetric const & end)
|
||||
: _start_metric (start)
|
||||
, _end_metric (end)
|
||||
, _duration (dur)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TempoMapCutBuffer::add (TempoPoint const & tp)
|
||||
{
|
||||
TempoPoint* ntp = new TempoPoint (tp);
|
||||
|
||||
ntp->set (tp.sclock() - _duration.position().superclocks(), tp.beats(), tp.bbt());
|
||||
|
||||
_tempos.push_back (*ntp);
|
||||
_points.push_back (*ntp);
|
||||
}
|
||||
|
||||
void
|
||||
TempoMapCutBuffer::add (MeterPoint const & mp)
|
||||
{
|
||||
MeterPoint* ntp = new MeterPoint (mp);
|
||||
|
||||
ntp->set (mp.sclock() - _duration.position().superclocks(), mp.beats(), mp.bbt());
|
||||
|
||||
_meters.push_back (*ntp);
|
||||
_points.push_back (*ntp);
|
||||
}
|
||||
|
||||
void
|
||||
TempoMapCutBuffer::add (MusicTimePoint const & mtp)
|
||||
{
|
||||
MusicTimePoint* ntp = new MusicTimePoint (mtp);
|
||||
|
||||
ntp->set (mtp.sclock() - _duration.position().superclocks(), mtp.beats(), mtp.bbt());
|
||||
|
||||
_bartimes.push_back (*ntp);
|
||||
_tempos.push_back (*ntp);
|
||||
_meters.push_back (*ntp);
|
||||
_points.push_back (*ntp);
|
||||
}
|
||||
|
||||
void
|
||||
TempoMapCutBuffer::clear ()
|
||||
{
|
||||
_tempos.clear ();
|
||||
_meters.clear ();
|
||||
_bartimes.clear ();
|
||||
_points.clear ();
|
||||
}
|
||||
|
|
|
@ -1144,6 +1144,44 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
|
|||
void drop_lookup_table ();
|
||||
};
|
||||
|
||||
class LIBTEMPORAL_API TempoMapCutBuffer
|
||||
{
|
||||
public:
|
||||
TempoMapCutBuffer (timecnt_t const &, TempoMetric const &, TempoMetric const &);
|
||||
|
||||
timecnt_t duration() const { return _duration; }
|
||||
|
||||
TempoMetric const & metric_at_start () const { return _start_metric; }
|
||||
TempoMetric const & metric_at_end () const { return _end_metric; }
|
||||
|
||||
typedef boost::intrusive::list<TempoPoint, boost::intrusive::base_hook<tempo_hook>> Tempos;
|
||||
typedef boost::intrusive::list<MeterPoint, boost::intrusive::base_hook<meter_hook>> Meters;
|
||||
typedef boost::intrusive::list<MusicTimePoint, boost::intrusive::base_hook<bartime_hook>> MusicTimes;
|
||||
typedef boost::intrusive::list<Point, boost::intrusive::base_hook<point_hook>> Points;
|
||||
|
||||
void add (TempoPoint const &);
|
||||
void add (MeterPoint const &);
|
||||
void add (MusicTimePoint const &);
|
||||
void add (Point const &);
|
||||
|
||||
void clear ();
|
||||
|
||||
Tempos const & tempos() const { return _tempos; }
|
||||
Meters const & meters() const { return _meters; }
|
||||
MusicTimes const & bartimes() const { return _bartimes; }
|
||||
Points const & points() const { return _points; }
|
||||
|
||||
private:
|
||||
TempoMetric _start_metric;
|
||||
TempoMetric _end_metric;
|
||||
timecnt_t _duration;
|
||||
|
||||
Tempos _tempos;
|
||||
Meters _meters;
|
||||
MusicTimes _bartimes;
|
||||
Points _points;
|
||||
};
|
||||
|
||||
class LIBTEMPORAL_API TempoCommand : public Command {
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user