API for adjusting step duration (gate length)

This commit is contained in:
Paul Davis 2018-11-07 15:19:38 -05:00
parent f127739bcb
commit 870b142f9b
2 changed files with 18 additions and 0 deletions

View file

@ -59,6 +59,7 @@ class Step : public PBD::Stateful {
void adjust_velocity (int amt);
void adjust_pitch (int amt);
void adjust_duration (double amt);
void adjust_octave (int amt);
Mode mode() const { return _mode; }

View file

@ -104,6 +104,23 @@ Step::set_enabled (bool yn)
_enabled = yn;
}
void
Step::adjust_duration (double amt)
{
const double new_dur = _duration + amt;
if (new_dur > 1.0) {
_duration = 1.0;
} else if (new_dur < 1.0/64.0) {
_duration = 0.0;
} else {
_duration = new_dur;
}
PropertyChange pc;
PropertyChanged (pc);
}
void
Step::adjust_pitch (int amt)
{