cursor.next()

• Nov 19, 2022 - 18:00

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.


Comments

In reply to 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 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.

Attachment Size
Screen Shot 2022-11-22 at 22.10.55.png 145.06 KB

In reply to 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.

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