referenceLinePosition property

int get referenceLinePosition

Returns the reference line position of the clef on the staff (0 = middle line, positive = above, negative = below).

Implementation

int get referenceLinePosition {
  switch (_clefType) {
    case ClefType.treble:
    case ClefType.treble8va:
    case ClefType.treble8vb:
    case ClefType.treble15ma:
    case ClefType.treble15mb:
      return 2; // G on the 2nd line
    case ClefType.bass:
    case ClefType.bass8va:
    case ClefType.bass8vb:
    case ClefType.bass15ma:
    case ClefType.bass15mb:
      return -2; // F on the 4th line (standard position)
    case ClefType.bassThirdLine:
      return -1; // F on the 3rd line

    // C clefs in all positions
    case ClefType.soprano:
      return 2; // C on the 1st line
    case ClefType.mezzoSoprano:
      return 1; // C on the 2nd line
    case ClefType.alto:
      return 0; // C on the 3rd line (middle line)
    case ClefType.tenor:
      return -1; // C on the 4th line
    case ClefType.baritone:
      return -2; // C on the 5th line
    case ClefType.c8vb:
      return 0; // C on the 3rd line (one octave below)
    case ClefType.percussion:
    case ClefType.percussion2:
    case ClefType.tab6:
    case ClefType.tab4:
      return 0; // Centered
  }
}