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

Fix GH#16227: MusicXML export is incorrect when using local timsig #509

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

Jojo-Schmitz
Copy link
Owner

Backport of musescore#23255

Resolves: musescore#16227

@Jojo-Schmitz Jojo-Schmitz force-pushed the 3.x-local_time_sig branch 3 times, most recently from 528e307 to bd2f093 Compare June 15, 2024 20:40
@Jojo-Schmitz
Copy link
Owner Author

Hmm, I don't understand those failing mtests, @lvinken?

@lvinken
Copy link

lvinken commented Jun 18, 2024

Will have a look, may take a few days.

@lvinken
Copy link

lvinken commented Jun 21, 2024

Root cause found for the backup duration issue (one moveToTick() is missing), working on a fix.

@Jojo-Schmitz
Copy link
Owner Author

Is it your changes in ExportMusicXml::writeMeasureStaves()? For those I didn'd find a counterpart in 3.x

@lvinken
Copy link

lvinken commented Jun 21, 2024

Yes, I think that is indeed the root cause. The fix is below. The issue with testLocalTimeSig14 I cannot yet explain.

diff --git a/importexport/musicxml/exportxml.cpp b/importexport/musicxml/exportxml.cpp
index b6e8b4f69c..b54e106682 100644
--- a/importexport/musicxml/exportxml.cpp
+++ b/importexport/musicxml/exportxml.cpp
@@ -2043,7 +2043,7 @@ void ExportMusicXml::moveToTick(const Fraction& t, const Fraction& stretch)
       Fraction stretchedM_tick { t + stretch * (tick() - t) };
 #ifdef DEBUG_TICK
       qDebug() << "t (target) " << fractionToQString(t) << " stretch " << fractionToQString(stretch)
-               << " _tick (current) " << fractionToQString(_tick) << " stretchedM_tick " << fractionToQString(stretched_tick);
+               << " _tick (current) " << fractionToQString(_tick) << " stretchedM_tick " << fractionToQString(stretchedM_tick);
 #endif
       if (t < _tick) {
 #ifdef DEBUG_TICK
@@ -7316,6 +7316,12 @@ void ExportMusicXml::writeMeasureTracks(const Measure* const m,
 
                   } // for (Segment* seg = ...
             _attr.stop(_xml);
+            const bool isLastVoiceOfStaff = st % VOICES == VOICES - 1;
+            const bool isLastVoiceOfLastStaff = st == etrack - 1;
+            if (isLastVoiceOfStaff && !isLastVoiceOfLastStaff) {
+                  // move tick to start of measure, generates backup to next staff, needs this staff's stretch
+                  moveToTick(m->tick(), stretch(_score, st, m->tick()));
+                  }
             } // for (int st = ...
       }

@lvinken
Copy link

lvinken commented Jun 21, 2024

Hmm, pasting a diff does not really work well :-(

@Jojo-Schmitz
Copy link
Owner Author

Jojo-Schmitz commented Jun 21, 2024

I fixed the pasting

@Jojo-Schmitz
Copy link
Owner Author

Jojo-Schmitz commented Jun 21, 2024

It seems testLocalTimeSig14 fails because 3.x doesn't (yet) export "measure-repeat".
Would need to find now which PR added that to Mu4...

Edit: that happened in musescore#6365

@Jojo-Schmitz Jojo-Schmitz marked this pull request as ready for review June 22, 2024 12:50
@Jojo-Schmitz Jojo-Schmitz merged commit b140ca3 into 3.x Jun 22, 2024
@Jojo-Schmitz Jojo-Schmitz deleted the 3.x-local_time_sig branch June 22, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants