From d1cc71150f09fa6ba34f8786c2c9727f89b795c4 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Sat, 9 Sep 2023 19:48:43 +0900 Subject: [PATCH] Adjust interpretation of swing amount Previously, 0 -> no swing (1:1, 50%) 50 -> triplet swing (2:1, 66%) 75 -> hard swing (3:1, 75%) 100 -> sextuplet swing (5:1, 83%) (default!) 150 -> absolute maximum (inf:1, 100%) This is rather confusing... One common interpretation uses percentages of the beat, where triplet swing is 66%. However, that causes precision issues since it's really 66.666... Since we already default to 100 and take "no swing" as zero, let's make that reference point triplet swing. Then the scale becomes: 0 -> no swing (1:1) 100 -> triplet swing (2:1) 150 -> hard swing (3:1) 200 -> sextuplet swing (5:1) 300 -> absolute maximum (inf:1) 300 doesn't make any sense, so let's change the range to -250 .. 250 which covers all useful values. Also remove the division through 100 and back, to avoid rounding issues. Signed-off-by: Asahi Lina --- gtk2_ardour/quantize_dialog.cc | 2 +- libs/ardour/quantize.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/quantize_dialog.cc b/gtk2_ardour/quantize_dialog.cc index 7e3f2a1aba..0b723893c0 100644 --- a/gtk2_ardour/quantize_dialog.cc +++ b/gtk2_ardour/quantize_dialog.cc @@ -77,7 +77,7 @@ QuantizeDialog::QuantizeDialog (PublicEditor& e) , strength_adjustment (100.0, 0.0, 100.0, 1.0, 10.0) , strength_spinner (strength_adjustment) , strength_label (_("Strength")) - , swing_adjustment (100.0, -130.0, 130.0, 1.0, 10.0) + , swing_adjustment (100.0, -250.0, 250.0, 1.0, 10.0) , swing_spinner (swing_adjustment) , swing_button (_("Swing")) , threshold_adjustment (0.0, -Temporal::ticks_per_beat, Temporal::ticks_per_beat, 1.0, 10.0) diff --git a/libs/ardour/quantize.cc b/libs/ardour/quantize.cc index 56fa063e8b..75aa1ad4c0 100644 --- a/libs/ardour/quantize.cc +++ b/libs/ardour/quantize.cc @@ -47,7 +47,7 @@ Quantize::Quantize (bool snap_start, bool snap_end, , _start_grid(start_grid) , _end_grid(end_grid) , _strength (strength/100.0) - , _swing (swing/100.0) + , _swing (swing) , _threshold (threshold) { } @@ -95,7 +95,7 @@ swing_position (Temporal::Beats pos, Temporal::Beats grid, double swing_strength swung_previous_grid_position = Beats(); } - const ratio_t r (200 * swing_strength, 300); + const ratio_t r (swing_strength, 300); if (swing_previous_grid_position) { swung_previous_grid_position = swung_previous_grid_position + (grid * r);