add method

void add(
  1. MusicalElement element
)

Add element to this voice.

The element is stored as-is. Note.voice and Chord.voice are final, so this method cannot back-fill the voice number: it has to be supplied at construction time, e.g. Note(pitch: ..., duration: ..., voice: 2). validate reports elements whose voice number disagrees with number.

Implementation

void add(MusicalElement element) {
  elements.add(element);
}