read note input and write copy to second staff on the fly?
Please, any ideas, how to read user input and write with a plugin a copy to second staff on the fly?
I am working on scordatura plugin (it is almost done) and now I try to add "on the fly" mode.
So plugin would read every UI input, than translate pitch and write modified to second staff.
Thank you for any ideas!
Comments
I believe selectionChanged is called upon note entry, so perhaps you can do something with that: https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/class…
You'd have to do something like checking whether the change was in your source staff; if it was, enter a note into the scordatura staff. But if the change was in the scordatura staff (because your plugin just entered a note there for example) then move the cursor back to the original staff to allow your user to do further note entry.
I'm doubtful whether this will not influence normal note entry by the user and think an "after the fact" plugin to run once over an entire staff is likely less error-prone.
In reply to I believe selectionChanged… by jeetee
Thank you.
This is exactly, what I tried to do.
But
state.selectionChanged
itself is not enough. It is triggered also, when user clicks some note.So I need to check, if MS is in note input mode. But dont know how exactly.
Combinantion with
state.startLayoutTick
seems to do trick.But how to check duration of entered note?
I tried to check last selected note. It almost work. But problem comes, if entered note croses barline.
This is snippet, what I have tried.
I would be wery greatfull for any ideas.
In reply to Thank you. This is exactly,… by sammik
Perhaps check
note.tieBack/Forward
and/ornote.firstTiedNote/lastTiedNote
https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/class…You then also have to verify that you've not already entered it into your copy and such