Fix patch-change auto-audition

This commit is contained in:
Robin Gareus 2017-09-14 19:00:08 +02:00
parent 14fcf86f03
commit 315792b215
2 changed files with 8 additions and 6 deletions

View file

@ -466,7 +466,7 @@ PatchChangeWidget::audition_next ()
piano_keyboard_set_note_off (_piano, _audition_note_num); piano_keyboard_set_note_off (_piano, _audition_note_num);
return ++_audition_note_num <= _audition_end_spin.get_value_as_int() && _audition_enable.get_active (); return ++_audition_note_num <= _audition_end_spin.get_value_as_int() && _audition_enable.get_active ();
} else { } 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); piano_keyboard_set_note_on (_piano, _audition_note_num);
return true; return true;
} }
@ -475,7 +475,7 @@ PatchChangeWidget::audition_next ()
void void
PatchChangeWidget::_note_on_event_handler(GtkWidget*, int note, gpointer arg) 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 void
@ -485,10 +485,12 @@ PatchChangeWidget::_note_off_event_handler(GtkWidget*, int note, gpointer arg)
} }
void void
PatchChangeWidget::note_on_event_handler (int note) PatchChangeWidget::note_on_event_handler (int note, bool for_audition)
{ {
cancel_audition (); if (!for_audition) {
_pianomm->grab_focus (); cancel_audition ();
_pianomm->grab_focus ();
}
uint8_t event[3]; uint8_t event[3];
event[0] = (MIDI_CMD_NOTE_ON | _channel); event[0] = (MIDI_CMD_NOTE_ON | _channel);
event[1] = note; event[1] = note;

View file

@ -104,7 +104,7 @@ private:
static void _note_on_event_handler (GtkWidget*, int, gpointer); static void _note_on_event_handler (GtkWidget*, int, gpointer);
static void _note_off_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); void note_off_event_handler (int);
}; };