typedef struct challenge
{
+ int active;
bin_t *bin;
int item_index;
score_staff_t *staff;
- score_note_t *note;
+ pitch_t pitch;
int satisfied;
int mistaken;
pitch_name_t pitch_name = PITCH_NATURAL (C, 0);
pitch_t pitch;
- if (scherzo->challenge.note)
- octave = PITCH_OCTAVE (scherzo->challenge.note->pitch);
+ if (scherzo->challenge.active)
+ octave = PITCH_OCTAVE (scherzo->challenge.pitch);
else
octave = scherzo->keyboard_octave;
pitch_name_t pitch_name = PITCH_NAME_C;
pitch_t pitch;
- if (scherzo->challenge.note)
- octave = PITCH_OCTAVE (scherzo->challenge.note->pitch);
+ if (scherzo->challenge.active)
+ octave = PITCH_OCTAVE (scherzo->challenge.pitch);
else
octave = scherzo->keyboard_octave;
scherzo_update_notes_and_chord (scherzo);
}
-void
+static void
_select_challenge (scherzo_t *scherzo)
{
category_t *category_unused;
item_t *item;
challenge_t *challenge = &scherzo->challenge;
pitch_name_t pitch_name;
- pitch_t pitch;
int octave;
char *s;
- if (challenge->note) {
- score_remove_note (challenge->note);
- challenge->note = NULL;
- }
-
mnemon_select_item (&scherzo->mnemon,
&challenge->bin,
&challenge->item_index,
octave = *s - '0';
- pitch = PITCH (pitch_name, PITCH_ACCIDENTAL_NATURAL, octave);
+ challenge->pitch = PITCH (pitch_name, PITCH_ACCIDENTAL_NATURAL, octave);
- challenge->note = score_staff_add_note (challenge->staff, pitch,
- SCORE_DURATION_WHOLE);
+ challenge->active = 1;
challenge->satisfied = 0;
challenge->mistaken = 0;
}
{
challenge_t *challenge = &scherzo->challenge;
- if (! challenge->note)
+ if (! challenge->active)
return;
- if (pitch == challenge->note->pitch)
+ if (pitch == challenge->pitch)
challenge->satisfied = 1;
else
challenge->mistaken = 1;
{
challenge_t *challenge = &scherzo->challenge;
- if (! challenge->note)
+ if (! challenge->active)
return;
if (! challenge->satisfied)
/* XXX: Should create a default file if one cannot be loaded. */
mnemon_load_category (&scherzo.mnemon, "scherzo-notes");
- scherzo.challenge.note = NULL;
+ scherzo.challenge.active = 0;
/*
_select_challenge (&scherzo);
*/