planTimed method
- List<
SoundEvent> events, { - Map<
String, List< ornaments = const {},OrnamentPart> > - DifficultyMap? difficulty,
O plano com o tempo humano (AV04): cada nota de events com o ataque, o fim
e a velocity que o aluno dá. ornaments espalha o ornamento por extenso pela
duração da nota (cada nota dele é uma nota do plano, com #k no id).
difficulty é o DifficultyMap da rodada (AV02): dele vêm o fator da nota,
o salto e a mudança de posição, e o compasso. Sem ele, todas as notas valem
como fáceis e nenhuma segura antes de salto.
Devolve as notas na ordem de events (com os ornamentos no lugar). O Perfeito
devolve as notas como estão, sem deslocar nada. Com a mesma semente, o mesmo
plano; o relógio continua entre as chamadas deste executante.
Implementation
List<PlannedNote> planTimed(
List<SoundEvent> events, {
Map<String, List<OrnamentPart>> ornaments = const {},
DifficultyMap? difficulty,
}) {
final notes = <PlannedNote>[];
for (final e in events) {
final d = difficulty?.noteOf(e);
final factor = d?.factor ?? kBaseFactor;
final leap = d == null ? 0.0 : d.term(DifficultyTerm.leap) / kLeapWeight;
final position = d == null
? 0.0
: d.term(DifficultyTerm.position) / kPositionWeight;
final expansion = ornaments[e.id];
if (expansion == null) {
notes.add(
PlannedNote(
id: e.id,
pitch: e.pitch,
staff: e.staff,
onMs: e.onMs,
offMs: e.offMs,
velocity: e.velocity,
factor: factor,
leap: leap,
position: position,
measure: d?.measure,
),
);
continue;
}
final length = e.offMs - e.onMs;
for (var k = 0; k < expansion.length; k++) {
final n = expansion[k];
notes.add(
PlannedNote(
id: '${e.id}#$k',
pitch: n.pitch,
staff: e.staff,
onMs: e.onMs + n.start * length,
offMs: e.onMs + n.end * length,
velocity: e.velocity,
factor: factor,
measure: d?.measure,
),
);
}
}
if (identical(profile, StudentProfile.perfect)) return notes;
return (_timing ??= HumanTiming(
profile: profile,
rng: rng ?? Random(kDefaultTimingSeed),
guided: guided,
)).apply(notes);
}