notesPerMeasureToNoteType static method

NoteType notesPerMeasureToNoteType(
  1. int noteCount
)

Resolves NoteType based on the number of Notes in a measure

Implementation

static NoteType notesPerMeasureToNoteType(int noteCount) {
  assert(noteCount <= 16);
  return switch (noteCount) {
    16 => NoteType.sixteenth,
    8 => NoteType.eighth,
    4 => NoteType.quarter,
    2 => NoteType.half,
    1 => NoteType.whole,
    _ => noteCount < 8 ? NoteType.eighth : NoteType.sixteenth,
  };
}