add well known controls to list accessible via a MIDI binding map (or OSC?)
[ardour.git] / libs / ardour / quantize.cc
index bcce41c96d2da0fe093ab34e95f080f7cabad055..27e40ae8f70066585f52d0240e7759af160a0cef 100644 (file)
@@ -23,7 +23,7 @@
 #include "ardour/quantize.h"
 #include "ardour/midi_model.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace PBD;
@@ -69,7 +69,7 @@ swing_position (double pos, double grid, double swing, double offset)
         * if the start grid is 1.0, the beat at 0 isn't swung,
         * but the beat at 1.0 is. the beat at 2.0 isn't swung,
         * but the beat at 3.0 is. and so on.
-        * 
+        *
         * so the criterion for a position being swung is
         * whether or not ((possible_grid_position / grid) % 2) != 0
         */
@@ -99,7 +99,7 @@ swing_position (double pos, double grid, double swing, double offset)
        /* now correct for start-of-model offset */
 
        pos += offset;
-                               
+
        if (fabs (pos - swung_pos) > fabs (pos - swung_previous_grid_position)) {
                pos = swung_previous_grid_position;
        } else {
@@ -111,8 +111,8 @@ swing_position (double pos, double grid, double swing, double offset)
 
 Command*
 Quantize::operator () (boost::shared_ptr<MidiModel> model,
-                       Evoral::Beats position,
-                       std::vector<Evoral::Sequence<Evoral::Beats>::Notes>& seqs)
+                       Temporal::Beats position,
+                       std::vector<Evoral::Sequence<Temporal::Beats>::Notes>& seqs)
 {
        /* TODO: Rewrite this to be precise with fixed point? */
 
@@ -125,17 +125,17 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
 
        MidiModel::NoteDiffCommand* cmd = new MidiModel::NoteDiffCommand (model, "quantize");
 
-       for (std::vector<Evoral::Sequence<Evoral::Beats>::Notes>::iterator s = seqs.begin(); s != seqs.end(); ++s) {
+       for (std::vector<Evoral::Sequence<Temporal::Beats>::Notes>::iterator s = seqs.begin(); s != seqs.end(); ++s) {
 
                for (Evoral::Sequence<MidiModel::TimeType>::Notes::iterator i = (*s).begin(); i != (*s).end(); ++i) {
 
                        /* compute new start + end points WITHOUT the offset
                         * caused by the start of the model (see above).
-                        * 
+                        *
                         * these versions of new_start and new_end are
                         * guaranteed to precisely align with the quantize grid(s).
                         */
-                       
+
                        double new_start = round (((*i)->time().to_double() - offset) / _start_grid) * _start_grid;
                        double new_end = round (((*i)->end_time().to_double() - offset) / _end_grid) * _end_grid;
 
@@ -143,7 +143,7 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
 
                                new_start = swing_position (new_start, _start_grid, _swing, offset);
                                new_end = swing_position (new_end, _end_grid, _swing, offset);
-                               
+
                        } else {
 
                                /* now correct for start-of-model offset */
@@ -151,10 +151,10 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
                                new_start += offset;
                                new_end += offset;
                        }
-                       
+
                        double delta = new_start - (*i)->time().to_double();
 
-                       
+
                        if (fabs (delta) >= _threshold) {
                                if (_snap_start) {
                                        delta *= _strength;
@@ -167,10 +167,10 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
                                delta = new_end - (*i)->end_time().to_double();
 
                                if (fabs (delta) >= _threshold) {
-                                       Evoral::Beats new_dur(new_end - new_start);
+                                       Temporal::Beats new_dur(new_end - new_start);
 
                                        if (!new_dur) {
-                                               new_dur = Evoral::Beats(_end_grid);
+                                               new_dur = Temporal::Beats(_end_grid);
                                        }
 
                                        cmd->change ((*i), MidiModel::NoteDiffCommand::Length, new_dur);