summaryrefslogtreecommitdiff
path: root/libs/ardour/quantize.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-10-23 02:12:50 +0200
committerRobin Gareus <robin@gareus.org>2013-10-23 02:12:50 +0200
commit9b086e18b501751e44df2f5ee3c8deea31370ce6 (patch)
treeb81dceb61cb3b387aaced19a4a23f11eaaaf5315 /libs/ardour/quantize.cc
parent98f53d11b3d379d0bb1ee9e5146d20258eaa4ead (diff)
fix midi quantization - part two
include position offset in rounding
Diffstat (limited to 'libs/ardour/quantize.cc')
-rw-r--r--libs/ardour/quantize.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/ardour/quantize.cc b/libs/ardour/quantize.cc
index a4543d773c..1caefe87a6 100644
--- a/libs/ardour/quantize.cc
+++ b/libs/ardour/quantize.cc
@@ -62,7 +62,7 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
to quantize relative to actual session beats (etc.) rather than from the
start of the model.
*/
- const double round_pos = ceil(position / _start_grid) * _start_grid;
+ const double round_pos = round(position / _start_grid) * _start_grid;
const double offset = round_pos - position;
bool even;
@@ -74,8 +74,8 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
for (Evoral::Sequence<MidiModel::TimeType>::Notes::iterator i = (*s).begin(); i != (*s).end(); ++i) {
- double new_start = round ((*i)->time() / _start_grid) * _start_grid + offset;
- double new_end = round ((*i)->end_time() / _end_grid) * _end_grid + offset;
+ double new_start = round (((*i)->time() - offset) / _start_grid) * _start_grid + offset;
+ double new_end = round (((*i)->end_time() - offset) / _end_grid) * _end_grid + offset;
if (_swing > 0.0 && !even) {