Enhance TimeSig object to have methods to return numerator and denominator
I am writing a plug in and want to export the Time Signature.
Unfortunately the TimeSig object only provides a method to return type - "an internal value describing the time signature. The only usage of this property is to copy the time signature from one TimeSig object to another"
There is a method to change the time signature:
change(int numerator, int denominator)
Could you add two methods, numerator and denominator to return the
numberator and denominator of a time signature? For example, 6 and 8 for the 6/8 time signature.
As a workaround, can you explain how to convert the internal method to a numerator/denominator time signature?
Documentation
http://musescore.org/en/plugin-development/timesig-object
Many thanks
Charles
Comments
I am also interested in having the functionality as described by ozcaveman.
In reply to re: Enhance TimeSig object by pablocito
Looks like it is already present in the 2.0 developments builds.
In reply to Looks like it is already by Marc Sabatella
Cool!
In the mean time, it looks like I can test the value of 'type' and then do a case/switch on that. For example, I am finding that 3/4 time is type = 196, 4/4 is 260 but 'common time' is 1073742084 ...
Any chance that those values will be stable until V2.0 comes out?
In reply to re: Looks like it is already by pablocito
I'd say there is virtually zero chance that anything will change in MuseScore 1.3 ever. The next release will be 2.0.
In reply to re: Looks like it is already by pablocito
By looking in MuseScore 1.3 code, time signatures subtype has the following comment:
subtype() is coded as:
bit 0-5 denominator (n)
bit 6-11 nominator1 (z1)
bit 12-17 nominator2
bit 18-23 nominator3
bit 24-29 nominator4
bit 30 variation (alla breve etc.)
Plus these definitions:
TSIG_FOUR_FOUR = 0x40000104
TSIG_ALLA_BREVE = 0x40002084
and the method to retrieve the fraction is coded as:
Fraction getSig() const { return getSig(subtype()); }
static Fraction getSig(int st) {
return Fraction(
((st>>24)& 0x3f)
+ ((st>>18)& 0x3f)
+ ((st>>12)& 0x3f)
+ ((st>>6) & 0x3f), st & 0x3f);
}
Hope this helps.
Ciao,
ABL