sightFeaturesOf function
Os recursos que ex usa de fato.
Implementation
Set<SightFeature> sightFeaturesOf(SightExercise ex) {
final out = <SightFeature>{};
if (ex.tonic.endsWith('m') ||
ex.keyChanges.values.any((k) => k.endsWith('m'))) {
out.add(SightFeature.minorKey);
}
if (ex.compound) out.add(SightFeature.compoundMeter);
if (ex.counterpoint) out.add(SightFeature.counterpoint);
_harmonyFeatures(ex, out);
for (final staff in [1, 2]) {
final voices = staff == 1 ? ex.right : ex.left;
for (var v = 0; v < voices.length; v++) {
for (var m = 0; m < voices[v].length; m++) {
for (final note in voices[v][m]) {
out.addAll(_noteFeatures(ex, staff, note, m));
}
}
}
_voiceFeatures(voices, staff, out);
}
_directionFeatures(ex, out);
if ([...sightLeftClefs(ex), ...sightRightClefs(ex)].any((c) => c)) {
out.add(SightFeature.clefChange);
}
if ([...sightOctaveShifts(ex), ...sightLowOctaveShifts(ex)].any((c) => c)) {
out.add(SightFeature.octaveShift);
}
if (sightCrossings(ex).isNotEmpty) out.add(SightFeature.handCrossing);
if (sightFastLeaps(ex).any((l) => l.semitones > sightFastLeapOctave)) {
out.add(SightFeature.fastLeap);
}
_eventFeatures(ex, sightSoundingEvents(ex), out);
_polyrhythm(ex, out);
return out;
}