Plugin API: Staff Type
In a Part which has a linked TAB and Notation pair of staves, how can I identify which staff is the TAB and which is the Notation?
The .MSCX file shows StaffType group="Pitched" or "Tablature" but I can't find these properties in the API documentation for Part.
Comments
You have to access that information via the part: staff.part.hasTabStaff should do the trick
In reply to You have to access that… by XiaoMigros
A Part with linked TAB and Notation has both hasTabStaff and hasPitchedStaff set to true but doesn't tell you whether the TAB or notation is the first staff.
In reply to A part with linked TAB and… by yonah_ag
are there any elements within the staff (such as notes, string data, or other) that are unique to a tab staff? if so, you could test if any of those are present
In reply to are there any elements… by XiaoMigros
I've been down that route but the notation even has fret number in linked staves! There must be something else that I'm missing as evident by the difference seen in the .mscx file clip shown above – and, of course, because Musescore knows to render one as TAB and the other as notation even when their positions in the paired stave are switched.
So the question really is: what elements in the object model are responsible for the section of mscx seen above?
In reply to I've been down that route… by yonah_ag
Just because there's a difference in the mscx doesn't mean said properties are exposed to the plugin api. I'm afraid I don't work with tab staves enough to be of any more help.
In reply to Just because there's a… by XiaoMigros
Good point! I might need a rethink. Thanks for your feedback.
In reply to Just because there's a… by XiaoMigros
After some detailed comparison I have found that element.line is -10000 for TAB notes and in the range -20 to +20 for notation notes, so I can use this to differentiate.