Fix quantization swing
- Fix selection of what beats to swing (was always done) - Fix swing strength (lack of precision rounded to 50% or 100%) - Fix model offset not being applied properly Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
parent
ca25b5c841
commit
f1004a445e
@ -81,8 +81,8 @@ swing_position (Temporal::Beats pos, Temporal::Beats grid, double swing_strength
|
|||||||
|
|
||||||
using namespace Temporal;
|
using namespace Temporal;
|
||||||
|
|
||||||
const bool swing_quantize_grid_position = pos > Beats() && ((pos/grid) % Beats (2, 0)) != Beats();
|
const bool swing_quantize_grid_position = pos > Beats() && ((pos/grid) % Beats (0, 2)) != Beats();
|
||||||
const bool swing_previous_grid_position = pos > grid && (((pos-grid)/grid) % Beats (2, 0)) != Beats();
|
const bool swing_previous_grid_position = pos > grid && (((pos-grid)/grid) % Beats (0, 2)) != Beats();
|
||||||
|
|
||||||
/* one of these will not be subject to swing */
|
/* one of these will not be subject to swing */
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ swing_position (Temporal::Beats pos, Temporal::Beats grid, double swing_strength
|
|||||||
swung_previous_grid_position = Beats();
|
swung_previous_grid_position = Beats();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ratio_t r (2 * swing_strength, 3);
|
const ratio_t r (200 * swing_strength, 300);
|
||||||
|
|
||||||
if (swing_previous_grid_position) {
|
if (swing_previous_grid_position) {
|
||||||
swung_previous_grid_position = swung_previous_grid_position + (grid * r);
|
swung_previous_grid_position = swung_previous_grid_position + (grid * r);
|
||||||
@ -105,16 +105,16 @@ swing_position (Temporal::Beats pos, Temporal::Beats grid, double swing_strength
|
|||||||
swung_pos = swung_pos + (grid * r);
|
swung_pos = swung_pos + (grid * r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now correct for start-of-model offset */
|
|
||||||
|
|
||||||
pos += offset;
|
|
||||||
|
|
||||||
if ((pos - swung_pos).abs() > (pos - swung_previous_grid_position).abs()) {
|
if ((pos - swung_pos).abs() > (pos - swung_previous_grid_position).abs()) {
|
||||||
pos = swung_previous_grid_position;
|
pos = swung_previous_grid_position;
|
||||||
} else {
|
} else {
|
||||||
pos = swung_pos;
|
pos = swung_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* now correct for start-of-model offset */
|
||||||
|
|
||||||
|
pos += offset;
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user