diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-03 04:13:05 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-03 04:13:05 +0000 |
commit | 64f9fac9a8ad94182fca885f09fd53a228561c01 (patch) | |
tree | 29595a1be0819726ad7366a3dc184332f3f509f0 /gtk2_ardour/midi_time_axis.cc | |
parent | e0edca5a2abd65d869348e4bddb9d07ecc156450 (diff) |
make step entry chord & triplet buttons do their thing, or something close to it
git-svn-id: svn://localhost/ardour2/branches/3.0@7530 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 89a138f8b9..0287a1c0ea 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -909,6 +909,10 @@ MidiTimeAxisView::start_step_editing () { step_edit_insert_position = _editor.get_preferred_edit_position (); step_edit_beat_pos = -1.0; + _step_edit_triplet_countdown = 0; + _step_edit_within_chord = 0; + _step_edit_chord_duration = 0.0; + step_edit_region = playlist()->top_region_at (step_edit_insert_position); if (step_edit_region) { @@ -989,14 +993,63 @@ MidiTimeAxisView::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocit return -1; } } - + step_edit_region_view->step_add_note (channel, pitch, velocity, step_edit_beat_pos, beat_duration); - step_edit_beat_pos += beat_duration; + + if (_step_edit_triplet_countdown > 0) { + _step_edit_triplet_countdown--; + + if (_step_edit_triplet_countdown == 0) { + _step_edit_triplet_countdown = 3; + } + } + + if (!_step_edit_within_chord) { + step_edit_beat_pos += beat_duration; + } else { + step_edit_beat_pos += 1.0/Meter::ticks_per_beat; // tiny, but no longer overlapping + _step_edit_chord_duration = beat_duration; + } } return 0; } +bool +MidiTimeAxisView::step_edit_within_triplet() const +{ + return _step_edit_triplet_countdown > 0; +} + +bool +MidiTimeAxisView::step_edit_within_chord() const +{ + return _step_edit_within_chord; +} + +void +MidiTimeAxisView::step_edit_toggle_triplet () +{ + if (_step_edit_triplet_countdown == 0) { + _step_edit_within_chord = false; + _step_edit_triplet_countdown = 3; + } else { + _step_edit_triplet_countdown = 0; + } +} + +void +MidiTimeAxisView::step_edit_toggle_chord () +{ + if (_step_edit_within_chord) { + _step_edit_within_chord = false; + step_edit_beat_pos += _step_edit_chord_duration; + } else { + _step_edit_triplet_countdown = 0; + _step_edit_within_chord = true; + } +} + void MidiTimeAxisView::step_edit_rest () { |