diff options
author | Robin Gareus <robin@gareus.org> | 2013-10-23 17:40:35 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-10-23 19:59:26 +0200 |
commit | 20c20b7ddfbbc5bf9888f39f41d6c243534cc94f (patch) | |
tree | 756a93ccc51f84620904f1912f2c5a3ed239a00d /libs/ardour/quantize.cc | |
parent | be69bf15dd2fbc414b35aa84167b863caf6d7677 (diff) |
Fix midi-note length when quantizing a swing rhythm
Note: 'swing' probably requires a 2nd iteration:
first quantize notes to the grid, then apply beat shift.
Diffstat (limited to 'libs/ardour/quantize.cc')
-rw-r--r-- | libs/ardour/quantize.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/ardour/quantize.cc b/libs/ardour/quantize.cc index 1caefe87a6..7da1edaaa1 100644 --- a/libs/ardour/quantize.cc +++ b/libs/ardour/quantize.cc @@ -72,6 +72,9 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, even = false; + /* TODO 'swing' probably requires a 2nd iteration: + * first quantize notes to the grid, then apply beat shift + */ for (Evoral::Sequence<MidiModel::TimeType>::Notes::iterator i = (*s).begin(); i != (*s).end(); ++i) { double new_start = round (((*i)->time() - offset) / _start_grid) * _start_grid + offset; @@ -86,6 +89,7 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, */ new_start = new_start + (2.0/3.0 * _swing * (next_grid - new_start)); + new_end = new_end + (2.0/3.0 * _swing * (next_grid - new_start)); } else if (_swing < 0.0 && !even) { @@ -96,6 +100,7 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model, */ new_start = new_start - (2.0/3.0 * _swing * (new_start - prev_grid)); + new_end = new_end - (2.0/3.0 * _swing * (new_start - prev_grid)); } |