From f96d6894e8a5e6889c2589ba305d78826b076d3f Mon Sep 17 00:00:00 2001 From: nick_m Date: Tue, 31 Jan 2017 05:02:02 +1100 Subject: remove unused empoMap::round_to_beat_subdivision() --- libs/ardour/tempo.cc | 96 ---------------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'libs/ardour/tempo.cc') diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index d690896c15..9d8633f19f 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -3688,102 +3688,6 @@ TempoMap::round_to_beat (framepos_t fr, RoundMode dir) return round_to_type (fr, dir, Beat); } -framepos_t -TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir) -{ - Glib::Threads::RWLock::ReaderLock lm (lock); - uint32_t ticks = (uint32_t) floor (max (0.0, beat_at_minute_locked (_metrics, minute_at_frame (fr))) * BBT_Time::ticks_per_beat); - uint32_t beats = (uint32_t) floor (ticks / BBT_Time::ticks_per_beat); - uint32_t ticks_one_subdivisions_worth = (uint32_t) BBT_Time::ticks_per_beat / sub_num; - - ticks -= beats * BBT_Time::ticks_per_beat; - - if (dir > 0) { - /* round to next (or same iff dir == RoundUpMaybe) */ - - uint32_t mod = ticks % ticks_one_subdivisions_worth; - - if (mod == 0 && dir == RoundUpMaybe) { - /* right on the subdivision, which is fine, so do nothing */ - - } else if (mod == 0) { - /* right on the subdivision, so the difference is just the subdivision ticks */ - ticks += ticks_one_subdivisions_worth; - - } else { - /* not on subdivision, compute distance to next subdivision */ - - ticks += ticks_one_subdivisions_worth - mod; - } - - if (ticks >= BBT_Time::ticks_per_beat) { - ticks -= BBT_Time::ticks_per_beat; - } - } else if (dir < 0) { - - /* round to previous (or same iff dir == RoundDownMaybe) */ - - uint32_t difference = ticks % ticks_one_subdivisions_worth; - - if (difference == 0 && dir == RoundDownAlways) { - /* right on the subdivision, but force-rounding down, - so the difference is just the subdivision ticks */ - difference = ticks_one_subdivisions_worth; - } - - if (ticks < difference) { - ticks = BBT_Time::ticks_per_beat - ticks; - } else { - ticks -= difference; - } - - } else { - /* round to nearest */ - double rem; - - /* compute the distance to the previous and next subdivision */ - - if ((rem = fmod ((double) ticks, (double) ticks_one_subdivisions_worth)) > ticks_one_subdivisions_worth/2.0) { - - /* closer to the next subdivision, so shift forward */ - - ticks = lrint (ticks + (ticks_one_subdivisions_worth - rem)); - - DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("moved forward to %1\n", ticks)); - - if (ticks > BBT_Time::ticks_per_beat) { - ++beats; - ticks -= BBT_Time::ticks_per_beat; - DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("fold beat to %1\n", beats)); - } - - } else if (rem > 0) { - - /* closer to previous subdivision, so shift backward */ - - if (rem > ticks) { - if (beats == 0) { - /* can't go backwards past zero, so ... */ - return 0; - } - /* step back to previous beat */ - --beats; - ticks = lrint (BBT_Time::ticks_per_beat - rem); - DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("step back beat to %1\n", beats)); - } else { - ticks = lrint (ticks - rem); - DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("moved backward to %1\n", ticks)); - } - } else { - /* on the subdivision, do nothing */ - } - } - - const framepos_t ret_frame = frame_at_minute (minute_at_beat_locked (_metrics, beats + (ticks / BBT_Time::ticks_per_beat))); - - return ret_frame; -} - MusicFrame TempoMap::round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMode dir) { -- cgit v1.2.3