find instrument at given note
I have a plugin that needs to apply different rules depending if violin, viola, cello or contrabass. Can I detect the instrument, I want to achieve something like this:
var chord = notes[i].parent
var segment = chord.parent
var measure = segment.parent
var staff = measure.staff
var part = staff.part
var instrument = part.instrument
But this is unable to get part from staff.part, despite from my understanding of docs it is referenced here https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/class…
Alternatively getting the part name would be fine too.
Comments
I think the doc is outdated, Segment and Measure somehow does not inherit Element's staff property.
(Note).staff.part OK
(Chord).staff.part OK
(Segment).staff NULL
(Measure).staff NULL
> get part name
pls see https://musescore.org/en/handbook/developers-handbook/plugins-3x#:~:tex…
or https://musescore.org/en/node/334752