+ /* Calculate offset from start of model to next closest quantize step,
+ 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 offset = round_pos - position;
+