infrastructure and implementation to allow "q" to drive quantize-selected-notes in midi edit mode

This commit is contained in:
Paul Davis
2022-08-31 13:53:55 -06:00
parent 02b05f295a
commit d2fc142e21
9 changed files with 91 additions and 14 deletions

View File

@@ -37,6 +37,12 @@ public:
Temporal::Beats position,
std::vector<Evoral::Sequence<Temporal::Beats>::Notes>&);
std::string name() const { return std::string ("quantize"); }
bool empty() const { return !_snap_start && !_snap_end; }
Temporal::Beats start_grid() const { return _start_grid; }
Temporal::Beats end_grid() const { return _end_grid; }
void set_start_grid (Temporal::Beats const &);
void set_end_grid (Temporal::Beats const &);
private:
bool _snap_start;

View File

@@ -162,6 +162,7 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
if (_snap_start) {
/* this is here because Beats intentionally does not have operator* (double) */
delta = Temporal::Beats::ticks (llrintf (delta.to_ticks()) * _strength);
std::cerr << "new start " << (*i)->time() + delta << " shift was " << delta << std::endl;
cmd->change ((*i), MidiModel::NoteDiffCommand::StartTime, (*i)->time() + delta);
}
}
@@ -185,3 +186,15 @@ Quantize::operator () (boost::shared_ptr<MidiModel> model,
return cmd;
}
void
Quantize::set_start_grid (Temporal::Beats const & sg)
{
_start_grid = sg;
}
void
Quantize::set_end_grid (Temporal::Beats const & eg)
{
_end_grid = eg;
}