repetition end barlines not listed as elements

• Dec 23, 2023 - 11:38

Consider this simple plugin that lists all elements of a cursor. I noticed that barLines are only listed as elements at the start of a system and if it is a repetition start. Strangely, a repetition end barLine is not picked up by this loop, why? This is a problem when trying to handle repetitions via plugin.

onRun: {
if (!curScore)
Qt.quit();
//create cursor
var cursor = curScore.newCursor();
cursor.rewind(Cursor.SCORE_START);

//loop over measure
while(cursor.measure) {
  console.log("----- Measure "+measureIdx+" -----");
  //loop over measure segments          
  var seg = cursor.measure.firstSegment;
  while(seg.nextInMeasure) {
    for (var voiceIdx = 0; voiceIdx<8; voiceIdx++) {
      var e = seg.elementAt(voiceIdx);
      if (e) {
        console.log(measureIdx + ", " + e.name+ ", tick: "+e.position.numerator+"/"+e.position.denominator);
      }
    }
  }

}
}

Do you still have an unanswered question? Please log in first to post your question.