Endless Loop

• Sep 21, 2024 - 07:37

Referring to https://musescore.org/en/node/320206, how can I determine that I added the final note? I do get an infinite loop.


Comments

check the cursor.tick vs. the previous cursor.tick

var done = false;
var i = 0;
while (done == false && cursor.segment && cursor.tick < endTick) {
var duration = inc;
cursor.setDuration(duration, 1920);
var curtime = cursor.tick;
cursor.addRest();
// see https://musescore.org/en/node/320206
// at the last measure cursor gets stuck: get out of the loop via done
if (cursor.tick == curtime) {
done = true;
}
} // end while segment

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