How do you move cursor by more than one segment.
I trying to make a look where each iteration the cursor moves +1
Example: first iteration - cursor.next()
second iteration - cursor.next() - cursor.next() third iteration - cursor.next() - cursor.next() cursor.next()
and so on.
You write a loop around it and have it call cursor.next() however many times you wish to move it?
In reply to You write a loop around it… by jeetee
I want to loop until the it reaches end of the staff or selection
In reply to I want to loop until the it… by kamilio141414
Not sure if you mean end of staff or end of system? The former is easy, because you can just call
next()till it returns false at the end of the score. And since a cursor is bound to a voice, it'll always follow its current staff.
End of system will be a lot harder to detect; automatic system breaks information isn't really exposed afaik.
If you want to loop over a selection though, it might be easier to do just that and not use a cursor at all?
In reply to Not sure if you mean end of… by jeetee
As you see in the picture I scan notes in first track and the paste them to second track with diferent duration.
But when i start I scan first note in track one the move to second track paste first note there, then i change again to the first track to check the second note but i use code cursor.rewind() which goes at the biggining of the track and the I move it one segment further cursor.next(), to scan second element.
Each iteration i have to use cursor.next one more time to get to the next element in order to scan in.
I dont know how to make loop for this.
In reply to As you see in the picture I… by kamilio141414
You could either not use a cursor at all and go over the segments directly.
Or (this seem the obvious answer to me), use two cursors? One to scan and another to write.
Or if that fails for some reason, read the starting tick of the first track segment and then use rewindToTick.
In reply to You could either not use a… by jeetee
var cursor = curScore.newCursor();
var cursor_1 = curScore.newCursor();
So just like this ?
I did not know you could you 2 cursors. (face palm)