Skip to content

Commit

Permalink
UI: b/piano-ctrl.js: support user defined grid size
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Westerfeld <[email protected]>
  • Loading branch information
swesterfeld committed Nov 5, 2023
1 parent bfc873d commit e45975f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ui/b/piano-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ let piano_clipboard = "[]";

function quantization (piano_roll)
{
const stepping = piano_roll.stepping ? piano_roll.stepping[0] : Util.PPQN;
return Math.min (stepping, Util.PPQN);
if (piano_roll.grid_mode == "auto")
{
const stepping = piano_roll.stepping ? piano_roll.stepping[0] : Util.PPQN;
return Math.min (stepping, Util.PPQN);
}
else
{
return piano_roll.grid_stepping;
}
}

function quantize (piano_roll, tick, nearest = true)
Expand All @@ -63,8 +70,7 @@ export class PianoCtrl {
}
quantization ()
{
const roll = this.piano_roll, stepping = roll.stepping ? roll.stepping[0] : Util.PPQN;
return Math.min (stepping, Util.PPQN);
return quantization (this.piano_roll);
}
quantize (tick, nearest = true)
{
Expand Down

0 comments on commit e45975f

Please sign in to comment.