From 60be0c27a10ea68a644a6d83294835699afc95a8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 11 Dec 2021 14:42:36 +0100 Subject: [PATCH] Use updated temporal API 1/2 --- libs/ardour/ardour/audio_playlist_source.h | 2 +- libs/ardour/ardour/audiofilesource.h | 2 +- libs/ardour/location.cc | 22 ++++++++++---------- libs/ardour/playlist.cc | 4 ++-- libs/ardour/region.cc | 12 +++++------ libs/ardour/session_state.cc | 6 +++--- libs/ardour/smf_source.cc | 4 ++-- libs/evoral/ControlList.cc | 10 ++++----- libs/surfaces/contourdesign/contourdesign.cc | 4 ++-- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h index 067ed4e154..255dd6f591 100644 --- a/libs/ardour/ardour/audio_playlist_source.h +++ b/libs/ardour/ardour/audio_playlist_source.h @@ -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; diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index c7293b9567..05b11c5976 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -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); diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 6a340847ad..52943dd290 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -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. */ diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index cd5d16441e..ab7b3f05ba 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -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 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; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 0ab17936fc..c73006a677 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -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()); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 3e8578aceb..fc12cb9c40 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -5450,7 +5450,7 @@ Session::archive_session (const std::string& dest, continue; } boost::shared_ptr afs = boost::dynamic_pointer_cast (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 afs = boost::dynamic_pointer_cast (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 afs = boost::dynamic_pointer_cast (i->second); - if (!afs || afs->length ().zero()) { + if (!afs || afs->length ().is_zero ()) { continue; } diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 472cc6afb7..ea74f71a83 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -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; } diff --git a/libs/evoral/ControlList.cc b/libs/evoral/ControlList.cc index 360586a085..28871f363e 100644 --- a/libs/evoral/ControlList.cc +++ b/libs/evoral/ControlList.cc @@ -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 ()) { diff --git a/libs/surfaces/contourdesign/contourdesign.cc b/libs/surfaces/contourdesign/contourdesign.cc index 5a8663a373..8f29a23331 100644 --- a/libs/surfaces/contourdesign/contourdesign.cc +++ b/libs/surfaces/contourdesign/contourdesign.cc @@ -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();