Tempo ramps -remove unused code.
authornick_m <mainsbridge@gmail.com>
Mon, 23 May 2016 19:56:16 +0000 (05:56 +1000)
committernick_m <mainsbridge@gmail.com>
Fri, 27 May 2016 13:38:17 +0000 (23:38 +1000)
libs/ardour/ardour/tempo.h
libs/ardour/tempo.cc

index 9cbd8b972755e4a47fff3f861bd2afe1e7165338..663b8a941120a6b0f2c23993b1483a32eaf54184 100644 (file)
@@ -410,7 +410,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        framepos_t round_to_bar  (framepos_t frame, RoundMode dir);
        framepos_t round_to_beat (framepos_t frame, RoundMode dir);
        framepos_t round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir);
-       void round_bbt (Timecode::BBT_Time& when, const int32_t& snap_divisor, RoundMode dir);
 
        void set_length (framepos_t frames);
 
index c28a4c04a93c5cf4874892888b7186e0e1d9d2ff..8599594b3ba451f8f8a9f91f6d97ae36c3aeebc7 100644 (file)
@@ -2743,124 +2743,6 @@ TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir)
        return ret_frame;
 }
 
-void
-TempoMap::round_bbt (BBT_Time& when, const int32_t& sub_num, RoundMode dir)
-{
-       if (sub_num == -1) {
-               if (dir > 0) {
-                       ++when.bars;
-                       when.beats = 1;
-                       when.ticks = 0;
-               } else if (dir < 0) {
-                       when.beats = 1;
-                       when.ticks = 0;
-               } else {
-                       const double bpb = meter_section_at_beat (beat_at_bbt_locked (_metrics, when)).divisions_per_bar();
-                       if ((double) when.beats > bpb / 2.0) {
-                               ++when.bars;
-                       }
-                       when.beats = 1;
-                       when.ticks = 0;
-               }
-
-               return;
-
-       } else if (sub_num == 0) {
-               const double bpb = meter_section_at_beat (beat_at_bbt_locked (_metrics, when)).divisions_per_bar();
-               if ((double) when.ticks > BBT_Time::ticks_per_beat / 2.0) {
-                       ++when.beats;
-                       while ((double) when.beats > bpb) {
-                               ++when.bars;
-                               when.beats -= (uint32_t) floor (bpb);
-                       }
-               }
-               when.ticks = 0;
-
-               return;
-       }
-
-       const uint32_t ticks_one_subdivisions_worth = BBT_Time::ticks_per_beat / sub_num;
-
-       if (dir > 0) {
-               /* round to next (or same iff dir == RoundUpMaybe) */
-
-               uint32_t mod = when.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 */
-                       when.ticks += ticks_one_subdivisions_worth;
-
-               } else {
-                       /* not on subdivision, compute distance to next subdivision */
-
-                       when.ticks += ticks_one_subdivisions_worth - mod;
-               }
-
-               if (when.ticks >= BBT_Time::ticks_per_beat) {
-                       ++when.beats;
-                       const double bpb = meter_section_at_beat (beat_at_bbt_locked (_metrics, when)).divisions_per_bar();
-                       if ((double) when.beats > bpb) {
-                               ++when.bars;
-                               when.beats = 1;
-                       }
-                       when.ticks -= BBT_Time::ticks_per_beat;
-               }
-
-       } else if (dir < 0) {
-               /* round to previous (or same iff dir == RoundDownMaybe) */
-
-               uint32_t difference = when.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 (when.ticks < difference) {
-                       --when.beats;
-                       const double bpb = meter_section_at_beat (beat_at_bbt_locked (_metrics, when)).divisions_per_bar();
-                       if ((double) when.beats < bpb) {
-                               --when.bars;
-                               //when.beats = 1;
-                       }
-                       when.ticks = BBT_Time::ticks_per_beat - when.ticks;
-               } else {
-                       when.ticks -= difference;
-               }
-
-       } else {
-               /* round to nearest */  double rem;
-               if ((rem = fmod ((double) when.ticks, (double) ticks_one_subdivisions_worth)) > (ticks_one_subdivisions_worth / 2.0)) {
-                       /* closer to the next subdivision, so shift forward */
-
-                       when.ticks = when.ticks + (ticks_one_subdivisions_worth - rem);
-
-                       if (when.ticks > Timecode::BBT_Time::ticks_per_beat) {
-                               ++when.beats;
-                               when.ticks -= Timecode::BBT_Time::ticks_per_beat;
-                       }
-
-               } else if (rem > 0) {
-                       /* closer to previous subdivision, so shift backward */
-
-                       if (rem > when.ticks) {
-                               if (when.beats == 0) {
-                                       /* can't go backwards past zero, so ... */
-                               }
-                               /* step back to previous beat */
-                               --when.beats;
-                               when.ticks = Timecode::BBT_Time::ticks_per_beat - rem;
-                       } else {
-                               when.ticks = when.ticks - rem;
-                       }
-               }
-       }
-}
-
 framepos_t
 TempoMap::round_to_type (framepos_t frame, RoundMode dir, BBTPointType type)
 {