Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC 2020: measure repeats #6365

Merged
merged 6 commits into from
Nov 22, 2020

Conversation

IsaacWeiss
Copy link
Contributor

@IsaacWeiss IsaacWeiss commented Jul 23, 2020

Resolves: https://musescore.org/en/node/10220

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue
  • I created the test (mtest, vtest, script test) to verify the changes I made

@IsaacWeiss IsaacWeiss force-pushed the gsoc-2020-measure-repeats branch 6 times, most recently from 6a531df to 0828d65 Compare July 30, 2020 04:26
libmscore/layout.cpp Outdated Show resolved Hide resolved
libmscore/layout.cpp Outdated Show resolved Hide resolved
libmscore/layout.cpp Outdated Show resolved Hide resolved
@@ -3735,7 +3721,7 @@ System* Score::collectSystem(LayoutContext& lc)
} else {
m->removeSystemHeader();
}
while (true) {
for (;;) {
// TODO: what if the nobreak group takes the entire system - is this correct?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcSabatella I think the answer is yes, but why might it not be?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea, but somehow it seems like something to be sure to test.

@IsaacWeiss IsaacWeiss force-pushed the gsoc-2020-measure-repeats branch 3 times, most recently from d0dde1a to d6e2d39 Compare August 3, 2020 04:43
@IsaacWeiss
Copy link
Contributor Author

For the record, the answer to that "(?)" in the latest commit message is a no. Doesn't produce correct output if the MeasureRepeat is in a multi-staff instrument (@MarcSabatella, testing and insights on this welcome).

} else {
Part* part = m->score()->parts().at(partIndex);
for (int i = 0; i < part->nstaves(); ++i) {
int staffIdx = part->staff(i)->idx();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably there is some slightly more clever way of dealing with this - if you look at the implementation of idx(), you'll see it's relying on indexOf, which is probably slow operation. Not that it really matters, and I know I told you this was the way to do it. But still, you asked for feedback, that's what I've got... :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved efficiency by only calling it once, before the loop commences.

@IsaacWeiss IsaacWeiss force-pushed the gsoc-2020-measure-repeats branch 2 times, most recently from 84e38ba to 19943c2 Compare August 10, 2020 03:00
@IsaacWeiss
Copy link
Contributor Author

IsaacWeiss commented Aug 10, 2020

Some notes on MusicXML handling of measure repeats in Sibelius (Ultimate 2020.6), Finale (26.3.1.520), and MuseScore (this branch):

  • Sibelius is just bad. It doesn't include the "number" attribute in the <measure-style> tag surrounding the <measure-repeat> tag (for when a part/instrument has more than one staff and the measure repeat is not the same in all staves); it doesn't write the "slashes" attribute; it can't even import its own exports.
  • Finale is better, unsurprisingly; I think MusicXML started there. Finale writes the "slashes" attribute as well as the staff "number", although it does not repeat the underlying content as the spec demands. Its export is definitely better than its import. The software actually only supports one- and two-measure repeats, and thus converts a four-measure repeat into two consecutive two-measure repeats on import (not good). Strangely, it also gets confused when importing its own exports, getting the end measure wrong.
  • MuseScore up to now has had no support for importing or exporting (and, of course, only one-measure repeats were supported in the software). I have implemented export for one-measure repeats as well as the new subtypes, including the "slashes" attribute (although I have yet to see a legitimate case where it is meaningful), the "number" attribute in the <measure-style> tag, and repeating all the content. This export is read perfectly by Finale, and, as designed, the repitition of the content gives Sibelius something that it can understand as an alternative. The import I have implemented ignores the "slashes" attribute if present, as there is for our purposes an identity between the slashes in the symbol and the number of measures it indicates. But it reads both Sibelius and Finale export correctly (or, in the case of Sibelius export, it reads it at least as well as Finale does).

Everything is thoroughly commented and commits have been squashed. I would welcome review from MusicXML specialist @lvinken.

@IsaacWeiss
Copy link
Contributor Author

Btw, for easier review of the export commit, enable "Hide whitespace changes." Most of writeMeasureTracks() was just indented one additional level.

@lvinken
Copy link
Contributor

lvinken commented Aug 10, 2020

I am perfectly willing to review, but I am severely time-limited at the moment. Most likely I will be unable to spend any time on this for about six weeks :-(.

@lvinken
Copy link
Contributor

lvinken commented Aug 14, 2020

Due to an unexpected change of plans, I may have time to look into this on short notice after all. will keep you posted.

@lvinken
Copy link
Contributor

lvinken commented Aug 14, 2020

Initial results (after clean build on MacOS):
tst_mxml_io fails on:

  • testBreaksMMRest.xml
  • testMultiMeasureRest1.xml
  • testMultiMeasureRest2.xml
  • testMultiMeasureRest3.xml
  • testMultiMeasureRest4.xml
  • testTboxAboveBelow3.xml
  • testTboxWords1.xml
    -> this probably indicates bugs are still present in the MusicXML import/export changes.

I also get a consistent crash on exiting MuseScore, but this may very well be unrelated. Stack trace:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.qt-project.QtQml 0x0000000119a0e3ad QQmlMetaType::qmlSingletonTypes() + 61
1 org.qt-project.QtQml 0x00000001199e2231 QQmlEngine::~QQmlEngine() + 81
2 org.qt-project.QtQml 0x00000001199e23ae QQmlEngine::~QQmlEngine() + 14
3 org.qt-project.QtCore 0x0000000119f136fb QObjectPrivate::deleteChildren() + 203
4 org.qt-project.QtCore 0x0000000119f134f7 QObject::~QObject() + 1831
5 org.musescore.MuseScore 0x000000011024f36e mu::framework::UiEngine::~UiEngine() + 158 (uiengine.cpp:54)
6 org.musescore.MuseScore 0x000000011024ee75 mu::framework::UiEngine::~UiEngine() + 21 (uiengine.cpp:54)
7 libsystem_c.dylib 0x00007fff7fceaeed __cxa_finalize_ranges + 351
8 libsystem_c.dylib 0x00007fff7fceb1fe exit + 55
9 libdyld.dylib 0x00007fff7fc3e01c start + 8

Finally, I seem to be unable to find any MusicXML test files. Did you create any ? If you did not, please do so.

@IsaacWeiss IsaacWeiss force-pushed the gsoc-2020-measure-repeats branch 2 times, most recently from 2315258 to 03f49e6 Compare August 14, 2020 23:35
@@ -7,7 +7,7 @@ class MeasureRepeatSettingsModel : public AbstractInspectorModel
{
Q_OBJECT

Q_PROPERTY(PropertyItem* numberPosition READ numberPosition CONSTANT)
Q_PROPERTY(PropertyItem * numberPosition READ numberPosition CONSTANT)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh-huh

@IsaacWeiss
Copy link
Contributor Author

@lvinken thanks, I've been dealing with a transition to an unfamiliar computer/operating system and only just got everything into place. I'll have a look at those test failures and create tests next week.

@lvinken
Copy link
Contributor

lvinken commented Aug 15, 2020

Hi Isaac, FYI, I also plan to review your code changes to the MusicXML importer/exporter, but haven't found the time to do so yet.

Wrt validating the behaviour, that is somewhat difficult. I find the text on http://usermanuals.musicxml.com/MusicXML/MusicXML.htm#CT-MusicXML-measure-repeat.htm quite vague and hard to understand. Furthermore, I do not have access to Finale. I do have Finale Notepad, which does not allow me to create measure repeats, but at least seems to import them.

@@ -399,7 +399,8 @@ class ScoreElement
#undef CONVERT

virtual bool isElement() const { return false; } // overridden in element.h
bool isChordRest() const { return isRest() || isChord() || isRepeatMeasure() || isMMRest(); }
bool isRestFamily() const { return isRest() || isMMRest() || isMeasureRepeat(); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I suggested "Type" here is that I was thinking of BarLineType that we used to check for a few related segments types in the same way. But, that's a bit different, so maybe not important to mimic its naming.

@IsaacWeiss
Copy link
Contributor Author

All done.

@IsaacWeiss
Copy link
Contributor Author

Re-rebased

- Fix #279071: "Don't Break" element creates hole at end of system
- Allow more than two measures to be grouped
- Allow adding/toggling NOBREAK by clicking palette
- Rename to "Group Measures"
- Adjust placement of break symbols
Co-authored-by: MarcSabatella <marc@outsideshore.com>
- Public before private
- Members prefixed with "m_"
…btypes 1/2/4

- Draw with font symbols instead of QPainterPath
- Automatically group measures and delete contents when adding MeasureRepeat
- Bring measure.h and measure.cpp in line with new code guidelines
- Hide rests by making measures (per MStaff) aware if they are part of measure repeat group
- Keep measures and element in sync at all times by handling (preventing/warning/special-casing) many user actions
- Add style options for numbering consecutive one-measure repeats
MMRests:
- Add vtests for old-style (all fonts), h-bar thickness and margin (Bravura)

MeasureRepeats:
- Add script tests for adding, cutting/copying with partial group selected, pasting into group, repeating selection from before group, executing split/join/insert/delete measure commands, adding repeat barlines, and adding time signature
- Add mtests for parts, MIDI, and MusicXML import/export
- Add vtests
- Update ref files
@IsaacWeiss IsaacWeiss mentioned this pull request Nov 20, 2020
@vpereverzev vpereverzev merged commit 28e5d11 into musescore:master Nov 22, 2020
@IsaacWeiss IsaacWeiss deleted the gsoc-2020-measure-repeats branch December 27, 2020 14:16
cbjeukendrup added a commit to cbjeukendrup/MuseScore that referenced this pull request Feb 19, 2021
RomanPudashkin added a commit that referenced this pull request Feb 19, 2021
…style-options

Bring back style options for Measure Repeats introduced in PR #6365
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jun 24, 2024
- Fix #279071: "Don't Break" element creates hole at end of system
- Allow more than two measures to be grouped
- Allow adding/toggling NOBREAK by clicking palette
- Rename to "Group Measures"
- Adjust placement of break symbols
Co-authored-by: MarcSabatella <marc@outsideshore.com>

Backport of musescore#6365, commit 1, plus some includes cleanup
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jun 26, 2024
- Fix #279071: "Don't Break" element creates hole at end of system
- Allow more than two measures to be grouped
- Allow adding/toggling NOBREAK by clicking palette
- Rename to "Group Measures"
- Adjust placement of break symbols
Co-authored-by: MarcSabatella <marc@outsideshore.com>

Backport of musescore#6365, commit 1, plus some includes cleanup
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jun 26, 2024
…btypes 1/2/4

- Draw with font symbols instead of QPainterPath
- Automatically group measures and delete contents when adding MeasureRepeat
- Bring measure.h and measure.cpp in line with new code guidelines
- Hide rests by making measures (per MStaff) aware if they are part of measure repeat group
- Keep measures and element in sync at all times by handling (preventing/warning/special-casing) many user actions
- Add style options for numbering consecutive one-measure repeats

Backport of musescore#6365, commit 3, plus some includes cleanup
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jun 26, 2024
…btypes 1/2/4

- Draw with font symbols instead of QPainterPath
- Automatically group measures and delete contents when adding MeasureRepeat
- Hide rests by making measures (per MStaff) aware if they are part of measure repeat group
- Keep measures and element in sync at all times by handling (preventing/warning/special-casing) many user actions
- Add style options for numbering consecutive one-measure repeats

Backport of musescore#6365, commit 3, plus some includes cleanup
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jun 26, 2024
…btypes 1/2/4

- Draw with font symbols instead of QPainterPath
- Automatically group measures and delete contents when adding MeasureRepeat
- Hide rests by making measures (per MStaff) aware if they are part of measure repeat group
- Keep measures and element in sync at all times by handling (preventing/warning/special-casing) many user actions
- Add style options for numbering consecutive one-measure repeats

Backport of musescore#6365, commit 3, plus some includes cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vtests This PR produces approved changes to vtest results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants