13
0

snap-revisited: Add finer (64ths and 128ths) Ruler scalings to match those Grid selections

This commit is contained in:
Ben Loftis 2021-02-20 10:29:03 -06:00
parent aa9698ba58
commit d644bb16f6
3 changed files with 23 additions and 4 deletions

View File

@ -2881,6 +2881,12 @@ Editor::snap_to_bbt (MusicSample presnap, RoundMode direction, SnapPref gpref)
case bbt_show_thirtyseconds:
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, 4 * divisor, direction);
break;
case bbt_show_sixtyfourths:
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, 8 * divisor, direction);
break;
case bbt_show_onetwentyeighths:
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, 16 * divisor, direction);
break;
}
} else {
ret = _session->tempo_map().round_to_quarter_note_subdivision (presnap.sample, get_grid_beat_divisions(_grid_type), direction);

View File

@ -972,7 +972,9 @@ private:
bbt_show_quarters,
bbt_show_eighths,
bbt_show_sixteenths,
bbt_show_thirtyseconds
bbt_show_thirtyseconds,
bbt_show_sixtyfourths,
bbt_show_onetwentyeighths
};
BBTRulerScale bbt_ruler_scale;

View File

@ -1086,7 +1086,7 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
if (beat_density > 2048) {
bbt_ruler_scale = bbt_show_many;
} else if (beat_density > 512) {
} else if (beat_density > 1024) {
bbt_ruler_scale = bbt_show_64;
} else if (beat_density > 256) {
bbt_ruler_scale = bbt_show_16;
@ -1100,8 +1100,12 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
bbt_ruler_scale = bbt_show_eighths;
} else if (beat_density > 1) {
bbt_ruler_scale = bbt_show_sixteenths;
} else {
} else if (beat_density > 0.5) {
bbt_ruler_scale = bbt_show_thirtyseconds;
} else if (beat_density > 0.25) {
bbt_ruler_scale = bbt_show_sixtyfourths;
} else {
bbt_ruler_scale = bbt_show_onetwentyeighths;
}
/* Now that we know how fine a grid (Ruler) is allowable on this screen, limit it to the coarseness selected by the user */
@ -1117,7 +1121,11 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
suggested_scale = std::min(suggested_scale, (int) bbt_show_sixteenths);
} else if (_grid_type == GridTypeBeatDiv8) {
suggested_scale = std::min(suggested_scale, (int) bbt_show_thirtyseconds);
} //ToDo: implement Rulers for 64ths and 128ths?
} else if (_grid_type == GridTypeBeatDiv16) {
suggested_scale = std::min(suggested_scale, (int) bbt_show_sixtyfourths);
} else if (_grid_type == GridTypeBeatDiv32) {
suggested_scale = std::min(suggested_scale, (int) bbt_show_onetwentyeighths);
}
bbt_ruler_scale = (Editor::BBTRulerScale) suggested_scale;
}
@ -1270,6 +1278,9 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
break;
case bbt_show_sixteenths:
case bbt_show_thirtyseconds:
case bbt_show_sixtyfourths:
case bbt_show_onetwentyeighths:
beats = distance (grid.begin(), grid.end());
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;