Documentation of Code?

• Dec 23, 2018 - 18:26

I've been trying to figure out what's going on, but almost nothing is commented and I can't seem to find any docs on the actual functions and variables. Musescore is really big, it really needs code docs. Or at least some comments in the header files. QT is great for diving, but still. Is there a wiki somewhere?


Comments

The main part to keep in mind is that libmscore is all about the actual score whilst mscore is all about how to interact with it. Files within both folders have names that should be quite clear as to what they represent.

Then there is:
- the brief introduction of https://musescore.org/en/handbook/developers-handbook/finding-your-way-…
- the slightly outdated but still relevant https://musescore.org/en/developers-handbook/references/design-implemen…
- the most recent https://musescore.org/en/developers-handbook/references/musescore-inter…

In reply to by jeetee

Alright, I'll be specific. What is rfrac and afrac? Fractions, k, got that part. But what fraction? There's no comments anywhere that I can find - at most, I think aFrac is supposed to be actual fraction, which tells me nothing. Using Qt's handy code stepper,

Fraction Fraction::fromTicks(int ticks)
{
return Fraction(ticks, MScore::division * 4).reduced();
}
Isn't that assuming that a measure is 4 beats long? So afrac is (ticksused)/(ticksin4/4measure)?

For rfrac... if measure, rfrac = afrac - m->afrac, is that then accounting for time signatures that have other than four beats per measure? and then... rtick is tick - parent->tick. So starting tick of the tuplet, minus what? Who is the parent? The measure/amount highlighted? is rfrac supposed to be negative?

I think Tuplets-> tick being the starting tick is the only comment I saw. Ooo! and division = 480, tick number for a quarter note. mscore at least was pretty well commented.

In reply to by Laurelin

In fact afrac and rfrac stand for "absolute fraction" and "relative fraction", where "relative" means that it is relative to the measure start (which means it will not normally be negative). These are analogs for tick() and rtick() functions and they are supposed be more precise than ticks for some cases like tuplets and more meaningful in general.
Concerning MScore::division, yes, as you found, it is number of ticks per quarter note, regardless of global or local time signature.

So yes, we have most of explanatory information on the code within the code itself, sometimes in the form of documentation comments before function definitions. It would be great to extract the existing information from the code to some single place (maybe doxygen or something like that can help?) and make it more complete but as far as I know we don't currently have any full code reference.

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