const [sounding, setSounding] = useState(false);
const played = usePlayedAnswer({
question: round.question,
listen: round.choice === null && !sounding,
source: 'midi',
onJudged: (answer) => drill.answer(answer.text, answer.correct),
});
<DrillCard round={round} … onSoundingChange={setSounding} marks={played.answer?.marks}
answerArea={<Button onClick={played.giveUp}>Show me</Button>} />
Listen for a theory question answered by playing, and judge it. The notes are heard with the same note following as a practice take, from the microphone or a MIDI instrument; the answer is judged from them by pitch — each note to play right, wrong, or missing — as soon as it is all in, or once the playing pauses short of it, or when
giveUpis called, andonJudgedis told. The instrument is open only whilelistenis on and the answer is wanted: turninglistenoff — while a card sounds the question, say — sets aside what was heard, and the answer is listened for afresh once it is on again. A question not answered by playing is not listened for.