add timepos_t::set_time_domain() to potentially change time domains
This commit is contained in:
parent
6f861c63b5
commit
25375ee6f4
@ -74,6 +74,7 @@ class LIBTEMPORAL_API timepos_t : public int62_t {
|
||||
bool zero () const { return val() == 0; }
|
||||
|
||||
Temporal::TimeDomain time_domain () const { if (flagged()) return Temporal::BeatTime; return Temporal::AudioTime; }
|
||||
void set_time_domain (Temporal::TimeDomain);
|
||||
|
||||
superclock_t superclocks() const { if (is_superclock()) return val(); return _superclocks (); }
|
||||
int64_t samples() const { return superclock_to_samples (superclocks(), TEMPORAL_SAMPLE_RATE); }
|
||||
|
@ -375,6 +375,20 @@ timepos_t::timepos_t (timecnt_t const & t)
|
||||
v = build (t.distance().flagged(), t.distance ().val());
|
||||
}
|
||||
|
||||
void
|
||||
timepos_t::set_time_domain (TimeDomain td)
|
||||
{
|
||||
if (td == time_domain()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (td == AudioTime) {
|
||||
v = build (false, superclock_to_samples (_superclocks(), TEMPORAL_SAMPLE_RATE));
|
||||
} else {
|
||||
v = build (true, _beats().to_ticks());
|
||||
}
|
||||
}
|
||||
|
||||
// timepos_t timepos_t::_max_timepos (Temporal::AudioTime);
|
||||
|
||||
timepos_t &
|
||||
|
Loading…
Reference in New Issue
Block a user