diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-06-06 12:16:15 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-06-06 12:16:15 +0000 |
commit | 1bc662e64ecfaa682dd99a9af5296f9a2e9eb949 (patch) | |
tree | be67bebe9a7dd4a5d3c7a87651684b4814fbf1dc /gtk2_ardour | |
parent | 654ab59d5273b70fb90ff863d330a4bc423365c6 (diff) |
incomplete change to allow all selected MIDI notes to have their velocity set to the same adjusted value (needs more work to find modifiers and/or add a dialog)
git-svn-id: svn://localhost/ardour2/branches/3.0@12581 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 35 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.h | 2 |
2 files changed, 27 insertions, 10 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 26b03b1a2f..8229c9bc29 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -665,12 +665,13 @@ MidiRegionView::scroll (GdkEventScroll* ev) trackview.editor().verbose_cursor()->hide (); - bool fine = !Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier); + bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier); + bool together = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier); if (ev->direction == GDK_SCROLL_UP) { - change_velocities (true, fine, false); + change_velocities (true, fine, false, together); } else if (ev->direction == GDK_SCROLL_DOWN) { - change_velocities (false, fine, false); + change_velocities (false, fine, false, together); } return true; } @@ -735,9 +736,10 @@ MidiRegionView::key_press (GdkEventKey* ev) bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier); bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier); + bool together = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier); if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) { - change_velocities (true, fine, allow_smush); + change_velocities (true, fine, allow_smush, together); } else { transpose (true, fine, allow_smush); } @@ -747,12 +749,14 @@ MidiRegionView::key_press (GdkEventKey* ev) bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier); bool fine = !Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier); + bool together = Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier); - if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) { - change_velocities (false, fine, allow_smush); - } else { + if (Keyboard::no_modifiers_active (ev->state)) { transpose (false, fine, allow_smush); + } else { + change_velocities (false, fine, allow_smush, together); } + return true; } else if (ev->keyval == GDK_Left && unmodified) { @@ -2824,9 +2828,10 @@ MidiRegionView::change_note_length (CanvasNoteEvent* event, Evoral::MusicalTime } void -MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush) +MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush, bool all_together) { int8_t delta; + int8_t value; if (_selection.empty()) { return; @@ -2855,7 +2860,19 @@ MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush) for (Selection::iterator i = _selection.begin(); i != _selection.end();) { Selection::iterator next = i; ++next; - change_note_velocity (*i, delta, true); + + if (all_together) { + if (i == _selection.begin()) { + change_note_velocity (*i, delta, true); + value = (*i)->note()->velocity() + delta; + } else { + change_note_velocity (*i, value, false); + } + + } else { + change_note_velocity (*i, delta, true); + } + i = next; } diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index ae663b8cfd..546d01ce23 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -274,7 +274,7 @@ public: void goto_previous_note (bool add_to_selection); void goto_next_note (bool add_to_selection); void change_note_lengths (bool, bool, Evoral::MusicalTime beats, bool start, bool end); - void change_velocities (bool up, bool fine, bool allow_smush); + void change_velocities (bool up, bool fine, bool allow_smush, bool all_together); void transpose (bool up, bool fine, bool allow_smush); void nudge_notes (bool forward); void channel_edit (); |