Follow text doesn't work for tempo marking with decimal
1. Create score.
2. Apply tempo text with crotchet to rest.
3. Change text to '80.5'.
4. 'View'>'Inspector'.
Result: 'Follow text' is ticked and the BPM is 80.0.
Note: This only seems to be reproducible with a 2.0 score.
Using MuseScore 2.0 Nightly Build 791625f - Mac 10.7.5.
Comments
Hi
Do you intend to fix this?
That's what he announced on the mailing list ;-)
Hey sorry, I'm working on a school project and we're learning to fix bugs in open source, and these are getting fixed so quickly that I thought I'd try to reserve one until I could figure out how to fix it, hahaha. If you want it fixed soon, I can find a different bug, but if not, give me a few days to get a grasp on things and I'll have it done
Okay, thanks!
So I'm part of the team working on this, and we're kinda stuck at the moment. We think this is probably an easy fix, but we'd be extremely grateful if anyone could help us better understand how to trace this problem and then fix it, that would be awesome! We plan to do more with Musescore bug correcting but need help on this first issue. Thanks in advance.
Hi. By quickly looking at the code I think the issue comes from the regexp used for finding tempo text in the string:
https://github.com/musescore/MuseScore/blob/master/libmscore/tempotext…
which apparently does not take into account the possible case in which the text is in the form "(digits).(digits)"
Probably also the following lines should be slightly modified to load the full correct value (I know little about regexp handling so I can't give much help).
Ciao,
ABL
As far as I understand that regex "\\s*=\\s*(\\d+)" means any ("*") amout of whitespace ("\s") followed by a "=" followd by any amount of whitespace, followed by one or more ("+") digits ("\d").
Would need to get extended to an optional part* containing one "." (or even a "," to comfort other locales) and one or more digits.
* here's were I chicken out ;-)
Hmm, maybe append "(\.\\d+)?"
Kindly review pull request
https://github.com/musescore/MuseScore/pull/1762
have you tested it? I can't get it to work, also get a compiler warning, indicating that a\ is missing.
Changing it to
"\\s*=\\s*(\\d+([\\.,]\\d+)?)"
Doesn't make it much better (fixes the compiler warning but still doesn't work at all, not even non-decimal tempo markings get recognized)
As I tried to say, also the lines following the regexp should probably be changed (on top of the change already suggested by Jojo-Schmitz).
QStringList sl = re.capturedTexts();
this line takes the text found with the regexp search and splits it into strings matching the subexpressions in the regexp. See this tutorial http://doc.qt.io/qt-5/qregexp.html#capturedTexts
Thus, in the old code the line:
if (sl.size() == 2) {
would check if the whole string was found and if a number was found (in the original code, the expression matching the digits was inside a couple of parenthesis and it was treated as a subexpression)
qreal nt = qreal(sl[1].toInt()) * tp[i].f;
this line was taking the subexpression (i.e. the number) and transforming to a value for tempo as defined in MuseScore internal code.
if (nt != _tempo) {
this line was checking if the tempo was actually changed.
_tempo = qreal(sl[1].toInt()) * tp[i].f;
this line was finally changing the tempo value.
So I would suggest you could create a subexpression including the whole number (refer to the Qt5 example link) and then converting to real (be careful about the difference between "." and ",") when computing the new tempo.
Hope this helps.
Have fun fixing this bug :-)
Ciao,
ABL
PR https://github.com/musescore/MuseScore/pull/1779
and now https://github.com/musescore/MuseScore/pull/1783
Fixed in 5a20231cee
Automatically closed -- issue fixed for 2 weeks with no activity.