underChangesOf function

List<UnderChange> underChangesOf(
  1. List<MelodyTarget> targets,
  2. List<ChartSlot> slots,
  3. UnderRule rule
)

As trocas de slots em que uma nota da targets começa junto com o acorde. Entre as trocas, a melodia sai sozinha (o estilo não pede nada).

Implementation

List<UnderChange> underChangesOf(
  List<MelodyTarget> targets,
  List<ChartSlot> slots,
  UnderRule rule,
) => [
  for (final target in targets)
    if (target.slot < slots.length &&
        slots[target.slot].chord != null &&
        (target.beat - slots[target.slot].startBeat).abs() < 1e-9)
      UnderChange(
        beat: target.beat,
        pitch: target.pitch,
        bar: target.bar,
        slot: target.slot,
        chord: slots[target.slot].chord!,
        rule: rule,
      ),
];