Fix patch-change auto-audition
authorRobin Gareus <robin@gareus.org>
Thu, 14 Sep 2017 17:00:08 +0000 (19:00 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 14 Sep 2017 17:23:37 +0000 (19:23 +0200)
gtk2_ardour/patch_change_widget.cc
gtk2_ardour/patch_change_widget.h

index 5d8f77b13c8c1b92ec322878a1b1cf75a664fb6a..75f42ea546a6a94f901b997f549f188d2da52713 100644 (file)
@@ -466,7 +466,7 @@ PatchChangeWidget::audition_next ()
                piano_keyboard_set_note_off (_piano, _audition_note_num);
                return ++_audition_note_num <= _audition_end_spin.get_value_as_int() && _audition_enable.get_active ();
        } else {
-               note_on_event_handler (_audition_note_num);
+               note_on_event_handler (_audition_note_num, true);
                piano_keyboard_set_note_on (_piano, _audition_note_num);
                return true;
        }
@@ -475,7 +475,7 @@ PatchChangeWidget::audition_next ()
 void
 PatchChangeWidget::_note_on_event_handler(GtkWidget*, int note, gpointer arg)
 {
-       ((PatchChangeWidget*)arg)->note_on_event_handler(note);
+       ((PatchChangeWidget*)arg)->note_on_event_handler(note, false);
 }
 
 void
@@ -485,10 +485,12 @@ PatchChangeWidget::_note_off_event_handler(GtkWidget*, int note, gpointer arg)
 }
 
 void
-PatchChangeWidget::note_on_event_handler (int note)
+PatchChangeWidget::note_on_event_handler (int note, bool for_audition)
 {
-       cancel_audition ();
-       _pianomm->grab_focus ();
+       if (!for_audition) {
+               cancel_audition ();
+               _pianomm->grab_focus ();
+       }
        uint8_t event[3];
        event[0] = (MIDI_CMD_NOTE_ON | _channel);
        event[1] = note;
index dcd5eaa171ff594f080ae08040c5e64b7a7de1d8..e1df94c0d0ff0a91e446ba7564e013de5e6a0706 100644 (file)
@@ -104,7 +104,7 @@ private:
 
        static void _note_on_event_handler (GtkWidget*, int, gpointer);
        static void _note_off_event_handler (GtkWidget*, int, gpointer);
-       void note_on_event_handler (int);
+       void note_on_event_handler (int, bool for_audition);
        void note_off_event_handler (int);
 };