projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't add a [shared] panner for the sends to monitoing section
[ardour.git]
/
libs
/
ardour
/
quantize.cc
diff --git
a/libs/ardour/quantize.cc
b/libs/ardour/quantize.cc
index 563b7bf4e761eb0629c16fa86da83d1fe38f5c26..7da1edaaa18732695a64ab7d678f9e3f5ce917ac 100644
(file)
--- a/
libs/ardour/quantize.cc
+++ b/
libs/ardour/quantize.cc
@@
-20,13
+20,8
@@
#include "pbd/basename.h"
#include "pbd/basename.h"
-#include "ardour/types.h"
#include "ardour/quantize.h"
#include "ardour/quantize.h"
-#include "ardour/session.h"
-#include "ardour/smf_source.h"
#include "ardour/midi_model.h"
#include "ardour/midi_model.h"
-#include "ardour/midi_region.h"
-#include "ardour/tempo.h"
#include "i18n.h"
#include "i18n.h"
@@
-67,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.
*/
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;
const double offset = round_pos - position;
bool even;
@@
-77,10
+72,13
@@
Quantize::operator () (boost::shared_ptr<MidiModel> model,
even = false;
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) {
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) {
if (_swing > 0.0 && !even) {
@@
-91,6
+89,7
@@
Quantize::operator () (boost::shared_ptr<MidiModel> model,
*/
new_start = new_start + (2.0/3.0 * _swing * (next_grid - new_start));
*/
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) {
} else if (_swing < 0.0 && !even) {
@@
-101,6
+100,7
@@
Quantize::operator () (boost::shared_ptr<MidiModel> model,
*/
new_start = new_start - (2.0/3.0 * _swing * (new_start - prev_grid));
*/
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));
}
}