Use updated temporal API 1/2

This commit is contained in:
Robin Gareus 2021-12-11 14:42:36 +01:00
parent 506bc3a6f6
commit 60be0c27a1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
9 changed files with 33 additions and 33 deletions

View File

@ -51,7 +51,7 @@ public:
int set_state (const XMLNode&, int version);
bool can_truncate_peaks() const { return false; }
bool can_be_analysed() const { return _length.positive(); }
bool can_be_analysed() const { return _length.is_positive(); }
protected:
friend class SourceFactory;

View File

@ -70,7 +70,7 @@ public:
int set_state (const XMLNode&, int version);
bool can_truncate_peaks() const { return true; }
bool can_be_analysed() const { return _length.positive(); }
bool can_be_analysed() const { return _length.is_positive(); }
static bool safe_audio_file_extension (const std::string& path);

View File

@ -216,7 +216,7 @@ Location::set_start (Temporal::timepos_t const & s, bool force)
scene_changed (); /* EMIT SIGNAL */
}
assert (s.zero() || s.positive());
assert (s.is_zero() || s.is_positive());
return 0;
} else if (!force) {
@ -240,7 +240,7 @@ Location::set_start (Temporal::timepos_t const & s, bool force)
}
}
assert (_start.positive() || _start.zero());
assert (_start.is_positive() || _start.is_zero());
return 0;
}
@ -296,7 +296,7 @@ Location::set_end (Temporal::timepos_t const & e, bool force)
}
}
assert (_end.positive() || _end.zero());
assert (_end.is_positive() || _end.is_zero());
return 0;
}
@ -355,7 +355,7 @@ Location::set (Temporal::timepos_t const & s, Temporal::timepos_t const & e)
}
}
assert (e.positive() || e.zero());
assert (e.is_positive() || e.is_zero());
}
if (start_change && end_change) {
@ -438,7 +438,7 @@ Location::set_is_clock_origin (bool yn, void*)
void
Location::set_skip (bool yn)
{
if (is_range_marker() && length().positive()) {
if (is_range_marker() && length().is_positive()) {
if (set_flag_internal (yn, IsSkip)) {
flags_changed (this);
FlagsChanged ();
@ -449,7 +449,7 @@ Location::set_skip (bool yn)
void
Location::set_skipping (bool yn)
{
if (is_range_marker() && is_skip() && length().positive()) {
if (is_range_marker() && is_skip() && length().is_positive()) {
if (set_flag_internal (yn, IsSkipping)) {
flags_changed (this);
FlagsChanged ();
@ -636,8 +636,8 @@ Location::set_state (const XMLNode& node, int version)
changed (this); /* EMIT SIGNAL */
Changed (); /* EMIT SIGNAL */
assert (_start.positive() || _start.zero());
assert (_end.positive() || _end.zero());
assert (_start.is_positive() || _start.is_zero());
assert (_end.is_positive() || _end.is_zero());
return 0;
}
@ -1265,7 +1265,7 @@ Locations::mark_at (timepos_t const & pos, timecnt_t const & slop) const
delta = pos.distance ((*i)->start());
}
if (slop.zero() && delta.zero()) {
if (slop.is_zero() && delta.is_zero()) {
/* special case: no slop, and direct hit for position */
return *i;
}
@ -1499,7 +1499,7 @@ Locations::range_starts_at (timepos_t const & pos, timecnt_t const & slop, bool
timecnt_t delta = (*i)->start().distance (pos).abs ();
if (delta.zero()) {
if (delta.is_zero()) {
return *i;
}
@ -1531,7 +1531,7 @@ Locations::ripple (timepos_t const & at, timecnt_t const & distance, bool includ
/* keep session range markers covering entire region if
a ripple "extends" the session.
*/
if (distance.positive() && (*i)->is_session_range()) {
if (distance.is_positive() && (*i)->is_session_range()) {
/* Don't move start unless it occurs after the ripple point.
*/

View File

@ -1551,7 +1551,7 @@ Playlist::ripple_locked (timepos_t const & at, timecnt_t const & distance, Regio
void
Playlist::ripple_unlocked (timepos_t const & at, timecnt_t const & distance, RegionList *exclude, ThawList& thawlist, bool notify)
{
if (distance.zero()) {
if (distance.is_zero()) {
return;
}
@ -3271,7 +3271,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
break;
}
if (!move_offset.zero()) {
if (!move_offset.is_zero()) {
/* fix the position to match any movement of the compound region. */
original->set_position (original->position() + move_offset);
modified_region = true;

View File

@ -474,7 +474,7 @@ Region::set_length (timecnt_t const & len)
return;
}
if (_length == len || len.zero()) {
if (_length == len || len.is_zero ()) {
return;
}
@ -747,13 +747,13 @@ Region::nudge_position (timecnt_t const & n)
return;
}
if (n.zero()) {
if (n.is_zero()) {
return;
}
timepos_t new_position = position();
if (n.positive()) {
if (n.is_positive()) {
if (position() > timepos_t::max (n.time_domain()).earlier (n)) {
new_position = timepos_t::max (n.time_domain());
} else {
@ -820,7 +820,7 @@ Region::move_start (timecnt_t const & distance)
timepos_t new_start (_start);
timepos_t current_start (_start);
if (distance.positive()) {
if (distance.is_positive()) {
if (current_start > timepos_t::max (current_start.time_domain()).earlier (distance)) {
new_start = timecnt_t::max(current_start.time_domain()); // makes no sense
@ -970,7 +970,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len)
timecnt_t const start_shift = position().distance (pos);
if (start_shift.positive()) {
if (start_shift.is_positive()) {
if (start() > timecnt_t::max() - start_shift) {
new_start = timepos_t::max (start().time_domain());
@ -978,7 +978,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len)
new_start = start() + start_shift;
}
} else if (start_shift.negative()) {
} else if (start_shift.is_negative()) {
if (start() < -start_shift && !can_trim_start_before_source_start ()) {
new_start = timecnt_t (start().time_domain());

View File

@ -5450,7 +5450,7 @@ Session::archive_session (const std::string& dest,
continue;
}
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (i->second);
if (!afs || afs->length ().zero()) {
if (!afs || afs->length ().is_zero ()) {
continue;
}
if (only_used_sources) {
@ -5469,7 +5469,7 @@ Session::archive_session (const std::string& dest,
continue;
}
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (i->second);
if (!afs || afs->length ().zero()) {
if (!afs || afs->length ().is_zero ()) {
continue;
}
@ -5533,7 +5533,7 @@ Session::archive_session (const std::string& dest,
continue;
}
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (i->second);
if (!afs || afs->length ().zero()) {
if (!afs || afs->length ().is_zero ()) {
continue;
}

View File

@ -241,7 +241,7 @@ SMFSource::read_unlocked (const Lock& lock,
DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("SMF read_unlocked: start in ticks %1\n", start_ticks));
if (_smf_last_read_end.zero() || start != _smf_last_read_end) {
if (_smf_last_read_end.is_zero() || start != _smf_last_read_end) {
DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("SMF read_unlocked: seek to %1\n", start));
Evoral::SMF::seek_to_start();
while (time < start_ticks) {
@ -756,7 +756,7 @@ SMFSource::destroy_model (const Glib::Threads::Mutex::Lock& lock)
void
SMFSource::flush_midi (const Lock& lock)
{
if (!writable() || _length.zero()) {
if (!writable() || _length.is_zero()) {
return;
}

View File

@ -540,13 +540,13 @@ ControlList::add_guard_point (timepos_t const & time, timecnt_t const & offset)
// caller needs to hold writer-lock
if (offset.negative() && when < offset) {
if (offset.is_negative() && when < offset) {
return;
}
assert (offset <= timecnt_t());
if (!offset.zero()) {
if (!offset.is_zero()) {
/* check if there are points between when + offset .. when */
ControlEvent cp (when + offset, 0.0);
iterator s;
@ -1050,7 +1050,7 @@ ControlList::shift (timepos_t const & time, timecnt_t const & distance)
Glib::Threads::RWLock::WriterLock lm (_lock);
double v0, v1;
if (distance.negative()) {
if (distance.is_negative()) {
/* Route::shift () with negative shift is used
* for "remove time". The time [pos.. pos-frames] is removed.
* and everyhing after, moved backwards.
@ -1074,14 +1074,14 @@ ControlList::shift (timepos_t const & time, timecnt_t const & distance)
}
/* add guard-points to retain shape, if needed */
if (distance.positive()) {
if (distance.is_positive()) {
ControlEvent cp (pos, 0.0);
iterator s = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
if (s != _events.end ()) {
_events.insert (s, new ControlEvent (pos, v0));
}
pos += distance;
} else if (distance.negative() && pos > 0) {
} else if (distance.is_negative() && pos > 0) {
ControlEvent cp (pos.decrement(), 0.0);
iterator s = lower_bound (_events.begin(), _events.end(), &cp, time_comparator);
if (s != _events.end ()) {

View File

@ -561,7 +561,7 @@ ContourDesignControlProtocol::prev_marker_keep_rolling ()
{
timepos_t pos = session->locations()->first_mark_before (timepos_t (session->transport_sample()));
if (pos.positive() || pos.zero()) {
if (pos.is_positive() || pos.is_zero()) {
session->request_locate (pos.samples());
} else {
session->goto_start ();
@ -573,7 +573,7 @@ ContourDesignControlProtocol::next_marker_keep_rolling ()
{
timepos_t pos = session->locations()->first_mark_after (timepos_t (session->transport_sample()));
if (pos.positive() || pos.zero()) {
if (pos.is_positive() || pos.is_zero ()) {
session->request_locate (pos.samples());
} else {
session->goto_end();