temporal: changes in API to better support BBT markers
This commit is contained in:
parent
531db75a27
commit
88a035b000
@ -673,6 +673,7 @@ MusicTimePoint::MusicTimePoint (TempoMap const & map, XMLNode const & node)
|
||||
, TempoPoint (map, *node.child (Tempo::xml_node_name.c_str()))
|
||||
, MeterPoint (map, *node.child (Meter::xml_node_name.c_str()))
|
||||
{
|
||||
node.get_property (X_("name"), _name); /* may fail, leaves name empty */
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
@ -685,9 +686,19 @@ MusicTimePoint::get_state () const
|
||||
node->add_child_nocopy (Tempo::get_state());
|
||||
node->add_child_nocopy (Meter::get_state());
|
||||
|
||||
node->set_property (X_("name"), _name); /* failure is OK */
|
||||
|
||||
return *node;
|
||||
}
|
||||
|
||||
void
|
||||
MusicTimePoint::set_name (std::string const & str)
|
||||
{
|
||||
_name = str;
|
||||
/* XXX need a signal or something to announce change */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TempoMapPoint::start_float ()
|
||||
{
|
||||
@ -1018,20 +1029,16 @@ TempoMap::remove_tempo (TempoPoint const & tp)
|
||||
}
|
||||
}
|
||||
|
||||
MusicTimePoint &
|
||||
TempoMap::set_bartime (BBT_Time const & bbt, timepos_t const & pos)
|
||||
void
|
||||
TempoMap::set_bartime (BBT_Time const & bbt, timepos_t const & pos, std::string name)
|
||||
{
|
||||
MusicTimePoint * ret;
|
||||
|
||||
assert (pos.time_domain() == AudioTime);
|
||||
|
||||
superclock_t sc (pos.superclocks());
|
||||
TempoMetric metric (metric_at (sc));
|
||||
MusicTimePoint* tp = new MusicTimePoint (*this, sc, metric.quarters_at_superclock (sc), bbt, metric.tempo(), metric.meter());
|
||||
MusicTimePoint* tp = new MusicTimePoint (*this, sc, metric.quarters_at_superclock (sc), bbt, metric.tempo(), metric.meter(), name);
|
||||
|
||||
ret = add_or_replace_bartime (tp);
|
||||
|
||||
return *ret;
|
||||
add_or_replace_bartime (tp);
|
||||
}
|
||||
|
||||
MusicTimePoint*
|
||||
|
@ -525,7 +525,9 @@ typedef boost::intrusive::list_base_hook<boost::intrusive::tag<struct bartime_ta
|
||||
class /*LIBTEMPORAL_API*/ MusicTimePoint : public bartime_hook, public virtual TempoPoint, public virtual MeterPoint
|
||||
{
|
||||
public:
|
||||
LIBTEMPORAL_API MusicTimePoint (TempoMap const & map, superclock_t sc, Beats const & b, BBT_Time const & bbt, Tempo const & t, Meter const & m) : Point (map, sc, b, bbt), TempoPoint (t, *this), MeterPoint (m, *this) {}
|
||||
LIBTEMPORAL_API MusicTimePoint (TempoMap const & map, superclock_t sc, Beats const & b, BBT_Time const & bbt, Tempo const & t, Meter const & m, std::string name = std::string())
|
||||
: Point (map, sc, b, bbt), TempoPoint (t, *this), MeterPoint (m, *this), _name (name) {}
|
||||
|
||||
LIBTEMPORAL_API MusicTimePoint (TempoMap const & map, XMLNode const &);
|
||||
|
||||
LIBTEMPORAL_API bool operator== (MusicTimePoint const & other) const {
|
||||
@ -534,7 +536,13 @@ class /*LIBTEMPORAL_API*/ MusicTimePoint : public bartime_hook, public virtual
|
||||
|
||||
LIBTEMPORAL_API timepos_t time() const { return timepos_t::from_superclock (TempoPoint::sclock()); }
|
||||
|
||||
LIBTEMPORAL_API std::string name() const { return _name; }
|
||||
LIBTEMPORAL_API void set_name (std::string const &);
|
||||
|
||||
LIBTEMPORAL_API XMLNode & get_state () const;
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
/** Tempo Map - mapping of timecode to musical time.
|
||||
@ -705,7 +713,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
|
||||
|
||||
LIBTEMPORAL_API void change_tempo (TempoPoint&, Tempo const&);
|
||||
|
||||
LIBTEMPORAL_API MusicTimePoint& set_bartime (BBT_Time const &, timepos_t const &);
|
||||
LIBTEMPORAL_API void set_bartime (BBT_Time const &, timepos_t const &, std::string name = std::string());
|
||||
LIBTEMPORAL_API void remove_bartime (MusicTimePoint const & tp);
|
||||
|
||||
LIBTEMPORAL_API TempoPoint& set_tempo (Tempo const &, BBT_Time const &);
|
||||
|
Loading…
Reference in New Issue
Block a user