How does cursor.track work

• Feb 23, 2024 - 21:02

How does the cursor.track work please

In my code I make a selection like I did in the picture below

When I use code with cursor.rewind(2) (endOfSelection) I get cursor.track = 3 but when I do cursor.rewind(1) beggining of a selection I get cursor.track = 0

Can anyone explain me what is going on

import QtQuick 2.0
import MuseScore 3.0

MuseScore {
menuPath: "Plugins.pluginName"
description: "Description goes here"
version: "1.0"
onRun: {
var cursor = curScore.newCursor()
cursor.rewind(2)
console.log(cursor.track)
}
}

Attachment Size
leadVox.png 33.01 KB

Comments

Every staff has 4 voices or tracks and track count continues across the staves. So, staff 0 has tracks 0,1,2,3. Staff 1 has tracks 4,5,6,7 etc...
cursor.rewind(2) takes you to last segment of track of selection.
cursor.rewind(1) takes you to first segment of first track.

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