This shouldn't actually be necessary, but in case there are ever any
stuck notes, this can help to clear them.
static void
_score_challenge (scherzo_t *scherzo);
static void
_score_challenge (scherzo_t *scherzo);
+static void
+pitch_group_remove_pitches (pitch_group_t *group);
+
+static void
+scherzo_update_notes_and_chord (scherzo_t *scherzo);
+
static int
on_delete_event_quit (unused (GtkWidget *widget),
unused (GdkEvent *event),
static int
on_delete_event_quit (unused (GtkWidget *widget),
unused (GdkEvent *event),
case GDK_KEY_space:
scherzo_press_pedal (scherzo);
break;
case GDK_KEY_space:
scherzo_press_pedal (scherzo);
break;
+ case GDK_KEY_Return:
+ /* Clear all notes when Return is pressed. */
+ pitch_group_remove_pitches (&scherzo->notes_pressed);
+ pitch_group_remove_pitches (&scherzo->notes_pedaled);
+ scherzo_update_notes_and_chord (scherzo);
+ break;
}
if (pitch != PITCH_NOT_A_PITCH)
}
if (pitch != PITCH_NOT_A_PITCH)
/* Allow an unhandled event to propagate to other handlers. */
return FALSE;
}
/* Allow an unhandled event to propagate to other handlers. */
return FALSE;
}
+/* Remove all pitches from a pitch_group_t */
+static void
+pitch_group_remove_pitches (pitch_group_t *group)
+{
+ talloc_free (group->pitches);
+ pitch_group_init (group->ctx, group);
+}
+
static void
scherzo_update_notes_and_chord (scherzo_t *scherzo)
{
static void
scherzo_update_notes_and_chord (scherzo_t *scherzo)
{