remove unused empoMap::round_to_beat_subdivision()
authornick_m <mainsbridge@gmail.com>
Mon, 30 Jan 2017 18:02:02 +0000 (05:02 +1100)
committernick_m <mainsbridge@gmail.com>
Sat, 4 Feb 2017 11:57:36 +0000 (22:57 +1100)
libs/ardour/ardour/tempo.h
libs/ardour/tempo.cc

index 1dce6347a0a1392a05db3404b5a27840abd1bd54..dd2d96e94ac18852f5b458c2298db83b27f00c0d 100644 (file)
@@ -388,7 +388,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
 
        MusicFrame round_to_bar  (framepos_t frame, RoundMode dir);
        MusicFrame round_to_beat (framepos_t frame, RoundMode dir);
-       framepos_t round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir);
        MusicFrame round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMode dir);
 
        void set_length (framepos_t frames);
index d690896c15f14d8cfd10491cc126bfd6b7d1c814..9d8633f19f6ae0bfefd64248c457d63ed2ae807f 100644 (file)
@@ -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)
 {