musicalValueByVoice property

  1. @override
Map<int, double> get musicalValueByVoice
override

Rhythmic value per voice, counting both the inherited Measure.elements list and the elements held by each Voice.

A voice contributes to its own voice number (Voice.number) regardless of the voice field of the notes it holds, since the container is the authoritative assignment here.

Implementation

@override
Map<int, double> get musicalValueByVoice {
  final byVoice = Map<int, double>.from(super.musicalValueByVoice);
  for (final entry in _voicesByNumber.entries) {
    double total = 0.0;
    for (final element in entry.value.elements) {
      total += Measure.musicalValueOf(element);
    }
    if (total <= 0.0) continue;
    byVoice[entry.key] = (byVoice[entry.key] ?? 0.0) + total;
  }
  return byVoice;
}