Manupulating staves
I don't see any definition for Staff object. How can I add a new staff, remove a staff, or change staff properties?
I don't see any definition for Staff object. How can I add a new staff, remove a staff, or change staff properties?
Do you still have an unanswered question? Please log in first to post your question.
Comments
Sorry, it's not clear to me.
The Staff indicates the presence of an instrument, and I can add other instruments by pressing 'I'
Staff Properties: https://musescore.org/en/handbook/staff-properties
What would you like to get?
See also: https://musescore.org/en/handbook/create-new-score#add-staff
In reply to Sorry, it's not clear to by Shoichi
This is about how to do it in a plugin...
In reply to This is about how to do it in by Jojo-Schmitz
thank you Jojo, sorry everyone, I am a little too worn :(
In reply to thank you Jojo, sorry by Shoichi
No, you're not. It's a good idea to add to the MuseScore object the ability to manipulate menu items, like DoCmd object in MS-Access.
In reply to No, you're not. It's a good by gideonrv
It's already possible. See for example
https://musescore.org/en/node/13705#comment-698636
There is a list of commands here https://github.com/musescore/MuseScore/blob/master/mscore/shortcut.cpp
In reply to It's already possible. See by [DELETED] 5
Yes, cmd("instruments") works exactly like pressing "I", and it's good news. However, I still don't know how to fill the instrument data from within the plugin.
In reply to Yes, cmd("instruments") works by gideonrv
Not via the
cmd
way as you can't do anything in a opened dialog that way.From the plugin reference manual in the plugin creator.
A Score object (such as
curScore
) has a read-only arrayparts
of objects of the typePart
. This corresponds with an 'instrument'. Further looking at the definition of the Part in the scripting engine reveals there are only a few properties you can change for it; beinglongName, mute, partName, shortName, show, volume
which correspond with some of the properties available in the staff-properties dialog.The Score object does allow you to add a new part to it using
void appendPart(const QString&)
. The string you have to provide should be (an educated guess, not tested) the value of theid
property from theInstrument
tag from the instruments.xml file (https://github.com/musescore/MuseScore/blob/master/share/instruments/in…)In reply to Not via the cmd way as you by jeetee
Jeetee, thank you very much. I understand now that Part is not as in Sibelius, but it stands for Instrument and Stuff.
I tried your solution, and your educated guess works. I only had to to some refreshing, like this:
curScore.startCmd();
curScore.appendPart("bass-guitar");
curScore.endCmd();
Still, I am far away from my goal, which is creating auto accompaniment, like they did in Harmony Assistant. The worst part is the Harmony object, as I referred here .
In reply to Jeetee, thank you very much. by gideonrv
You'd better do this in C++ and not with the plugin framework...
In reply to You'd better do this in C++ by [DELETED] 5
Sorry, I took a C++ course in 2002, and then came C#, which is easier... That's why I can't participate in MuseScore development.
In reply to Sorry, I took a C++ course in by gideonrv
The amount of time it would take to dust off your C++ skills is probably a small fraction of the time it would take to try to get anything this ambitious working via the plugin framework.
In reply to The amount of time it would by Marc Sabatella
I don't know if an old war horse like me is still able to participate in a new battle, but I'll try to do my best.
In reply to I don't know if an old war by gideonrv
FWIW, I first learned C++ back in 1987, or as I sometimes say, about 10 minutes after Bjarne Stroustrup invented it :-). After a few years in the software world, I took an almost twenty year hiatus to do music full time before getting back into C++ programming specifically to help with MuseScore. So I do know a thing or two about old war horses going back into battle :-)
In reply to FWIW, I first learned C++ by Marc Sabatella
Talking about old horses, I am exactly 5 years older than Bjarne Stroustrup :-)
To start with, I am interested in exposing more properties of the Harmony object. I looked into harmony.h, and found that you made a fix 26 days ago, which means that you understand something about this object. then I found that there are three Q_PROPERTY macro calls corresponding to the three exposed properties. I found also two interesting internal variables:
QString _textName
andQList _degreeList
, and I suspect that they keep the information I need.So before I learn to use Qt Creator, GitHub, and all the other staff, would you like to expose those two properties?
In reply to Talking about old horses, I by gideonrv
I understand much more about Harmony objects than I do about the plugin framework, but feel file to a formal feature request via the issue tracker and I will put looking into this further on my "to do" list.