summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
05c2816)
For multiple MIDI messages in a single buffer, only queue a single redraw.
GTK+ should be coalescing these anyway, but we might as well not make
it work any harder than it has too.
ssize_t remaining;
snd_seq_event_t event;
score_note_t *note;
ssize_t remaining;
snd_seq_event_t event;
score_note_t *note;
+ int need_redraw = FALSE;
remaining = read (scherzo->midi_fd, buf, MIDI_BUF_SIZE);
remaining = read (scherzo->midi_fd, buf, MIDI_BUF_SIZE);
case SND_SEQ_EVENT_NOTEON:
note = scherzo_add_note_midi (scherzo, event.data.note.note);
_judge_note (scherzo, note);
case SND_SEQ_EVENT_NOTEON:
note = scherzo_add_note_midi (scherzo, event.data.note.note);
_judge_note (scherzo, note);
- gtk_widget_queue_draw (scherzo->window);
break;
case SND_SEQ_EVENT_NOTEOFF:
scherzo_remove_note_midi (scherzo, event.data.note.note);
_score_challenge (scherzo);
break;
case SND_SEQ_EVENT_NOTEOFF:
scherzo_remove_note_midi (scherzo, event.data.note.note);
_score_challenge (scherzo);
- gtk_widget_queue_draw (scherzo->window);
break;
case SND_SEQ_EVENT_CLOCK:
/* Ignore for now as my piano sends a constant stream of these. */
break;
case SND_SEQ_EVENT_CLOCK:
/* Ignore for now as my piano sends a constant stream of these. */
+
+ if (need_redraw)
+ gtk_widget_queue_draw (scherzo->window);
+
/* Return TRUE to continue to get called in the future. */
return TRUE;
}
/* Return TRUE to continue to get called in the future. */
return TRUE;
}