summaryrefslogtreecommitdiff
path: root/libs/ardour/tempo.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-01-31 05:02:02 +1100
committernick_m <mainsbridge@gmail.com>2017-02-04 22:57:36 +1100
commitf96d6894e8a5e6889c2589ba305d78826b076d3f (patch)
tree310237a4c767052249c219fac7436d20fd9874e5 /libs/ardour/tempo.cc
parent04c484089c5f1ff064b111ce3e4f1e2ff7e7ec83 (diff)
remove unused empoMap::round_to_beat_subdivision()
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r--libs/ardour/tempo.cc96
1 files changed, 0 insertions, 96 deletions
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)
{