mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
editor: refactor snap to bbt to allow specifying non-grid-setting grid type
This commit is contained in:
parent
49439d2acf
commit
ece438d73d
2 changed files with 12 additions and 1 deletions
|
|
@ -2952,6 +2952,12 @@ Editor::snap_to_cd_frames (timepos_t const & presnap, Temporal::RoundMode direct
|
||||||
|
|
||||||
timepos_t
|
timepos_t
|
||||||
Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, SnapPref gpref)
|
Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, SnapPref gpref)
|
||||||
|
{
|
||||||
|
return _snap_to_bbt (presnap, direction, gpref, _grid_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
timepos_t
|
||||||
|
Editor::_snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, SnapPref gpref, GridType grid_type)
|
||||||
{
|
{
|
||||||
timepos_t ret(presnap);
|
timepos_t ret(presnap);
|
||||||
TempoMap::SharedPtr tmap (TempoMap::use());
|
TempoMap::SharedPtr tmap (TempoMap::use());
|
||||||
|
|
@ -2963,7 +2969,7 @@ Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, S
|
||||||
* nearby grid and walk towards the next bar point.
|
* nearby grid and walk towards the next bar point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (_grid_type == GridTypeBar) {
|
if (grid_type == GridTypeBar) {
|
||||||
TempoMetric m (tmap->metric_at (presnap));
|
TempoMetric m (tmap->metric_at (presnap));
|
||||||
BBT_Argument bbt (m.bbt_at (presnap));
|
BBT_Argument bbt (m.bbt_at (presnap));
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
|
|
|
||||||
|
|
@ -2387,6 +2387,11 @@ private:
|
||||||
Temporal::RoundMode direction,
|
Temporal::RoundMode direction,
|
||||||
ARDOUR::SnapPref gpref);
|
ARDOUR::SnapPref gpref);
|
||||||
|
|
||||||
|
Temporal::timepos_t _snap_to_bbt (Temporal::timepos_t const & start,
|
||||||
|
Temporal::RoundMode direction,
|
||||||
|
ARDOUR::SnapPref gpref,
|
||||||
|
Editing::GridType grid_type);
|
||||||
|
|
||||||
void snap_to_internal (Temporal::timepos_t& first,
|
void snap_to_internal (Temporal::timepos_t& first,
|
||||||
Temporal::RoundMode direction = Temporal::RoundNearest,
|
Temporal::RoundMode direction = Temporal::RoundNearest,
|
||||||
ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual,
|
ARDOUR::SnapPref gpref = ARDOUR::SnapToAny_Visual,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue