changes needed to get audio_clock.cc to work
This commit is contained in:
parent
7433bc27e0
commit
8fb70885ec
@ -162,6 +162,7 @@ class LIBTEMPORAL_API timepos_t : public int62_t {
|
||||
timepos_t earlier (BBT_Offset const & d) const;
|
||||
|
||||
/* like ::earlier() but changes this. loosely equivalent to operator-= */
|
||||
timepos_t & shift_earlier (timepos_t const & d);
|
||||
timepos_t & shift_earlier (timecnt_t const & d);
|
||||
timepos_t & shift_earlier (Temporal::Beats const &);
|
||||
timepos_t & shift_earlier (Temporal::BBT_Offset const &);
|
||||
@ -351,6 +352,8 @@ class LIBTEMPORAL_API timecnt_t {
|
||||
timecnt_t operator*(ratio_t const &) const;
|
||||
timecnt_t operator/(ratio_t const &) const;
|
||||
|
||||
ratio_t operator/ (timecnt_t const &) const;
|
||||
|
||||
timecnt_t operator-() const;
|
||||
timecnt_t operator- (timecnt_t const & t) const;
|
||||
timecnt_t operator+ (timecnt_t const & t) const;
|
||||
|
@ -72,6 +72,8 @@ class _ratio_t {
|
||||
bool is_unity() const { return _numerator == _denominator; }
|
||||
bool is_zero() const { return _numerator == 0; }
|
||||
|
||||
operator double() const { return (double) _numerator / _denominator; };
|
||||
|
||||
/* provide an easy way to multiply double by ratio_t. Note that this
|
||||
must be written as ratio_t * double, not the other way around. We
|
||||
are not trying to duplicate boost::rational here (which also doesn't
|
||||
|
@ -116,6 +116,20 @@ timecnt_t::operator*(ratio_t const & r) const
|
||||
return timecnt_t (v, _position);
|
||||
}
|
||||
|
||||
ratio_t
|
||||
timecnt_t::operator/ (timecnt_t const & other) const
|
||||
{
|
||||
if (time_domain() == other.time_domain()) {
|
||||
return ratio_t (distance().val(), other.distance().val());
|
||||
}
|
||||
|
||||
if (time_domain() == AudioTime) {
|
||||
return ratio_t (distance().val(), other.samples());
|
||||
}
|
||||
|
||||
return ratio_t (beats().to_ticks(), other.beats().to_ticks());
|
||||
}
|
||||
|
||||
timecnt_t
|
||||
timecnt_t::operator/(ratio_t const & r) const
|
||||
{
|
||||
@ -393,6 +407,16 @@ timepos_t::earlier (timecnt_t const & distance) const
|
||||
|
||||
/* */
|
||||
|
||||
timepos_t &
|
||||
timepos_t::shift_earlier (timepos_t const & d)
|
||||
{
|
||||
if (d.time_domain() == AudioTime) {
|
||||
return shift_earlier (d.superclocks());
|
||||
}
|
||||
|
||||
return shift_earlier (d.beats());
|
||||
}
|
||||
|
||||
timepos_t &
|
||||
timepos_t::shift_earlier (timecnt_t const & d)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user