Some questions about the code

• Jul 30, 2009 - 10:11

I'm trying to adding some new feature to Musescore but It's hard to understand the relationship between those elements such as measures, segments, elements, staff... in the code. I really want to know whole structure of them. Some parameters like tick, staffidx...

Actually, my mission is adding little barline previous to the new small clef when I changed the clef in a measure.
it would be appreciate if someone can help.


There is no documentation except the developer handbook. I learned the little I know by changing the code and trying.
Maybe the features you want are already in, or someone is working on it. Can you give more information? You can attach an image.

In reply to by dmak

Thanks for the list of request. Unfortunatly I'm pretty sure only a few people will open the doc file. It's better posting full text.
Some information regarding your requests:
1 - Rest and stem are movable -> Double click a rest and use the arrows key
2 - Moving a note (notehead + stem + tail). Why ? Changing pitches is already possible. But moving horizontally will beak the layout.
3 - I'm not sure it's a good idea to rely on the Volume set in a windows which can be hidden to export in MIDI or Wave.
4 - Midi is not suitable for sheet music exchange. Having a 100% match between mid files export/import looks impossible to me.(but I might be wrong). The standard for sheet music exchange is MusicXML.
5 - This is indeed a bug. Measure operation can be improve a lot and there are some bugs in the issue tracker
6 - When a clef is changed at end of line, there should be a barline before the small clef.
I checked sibelius to be sure and it's not default behavior. Do you have printing example?
7 - When there is a key change on new line, there should be a precaution key change at end of previous line with a barline before
I agree. Even maybe a double barline.
7bis and 8 - I don't see your point. Sorry ...
9 - Midi import/export can be improved indeed. Maybe it's a good place to start.

Hope it helps.

In reply to by [DELETED] 5

Those requests they are my project objectives, and what I want to know is how to learn the code more easily, the structure relationship and parameters meaning etc... if now focus on request 7, if I intend to insert a precaution key change with a barline at the end of previous line, how can I do this?
I'm trying to adding some code in void Staff::changeKeySig(int tick, int st) in staff.cpp, is that right? anything should I care? the undo stack? any hints? cause I don't know how to start coding.

Thanks for you help!

In reply to by dmak

With regards to implementation, the bar line should appear in before the key signature only. In your document you show a bar line before and after the cautionary key signatures making it look like it is in its own measure. This notation is not correct.

To see what key changes and clef changes look like at the end of the line as well as the middle of a line see attached. The following screenshot was taken from Finale.

Attachment Size
cautionary clefs and keys.png 1.76 KB

In reply to by dmak

With regards to hints to start coding I would recommend looking at the code for cautionary clefs and study how it is implemented there.

EDIT: You could also look at the code for cautionary times signatures as well. It actually has the bar line on the same side as you would need for key signatures.

In reply to by [DELETED] 5

Is not a school assignment, it is a request of a music school.
They want it to be a material in classes. All I have to do is following what they want in the doc and make it more stable.

In reply to by dmak

Time positions and durations are measured in "ticks" in mscore. A quarter note has the duration of 480 ticks (one "division"). This notation is used in midi or sequencer like application.
In version 0.9.6 ticks will be partly replaced by a fractional representation for durations (nominator/denominator) to be able to handle tuplets (and nested tuplets).

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