MusicXML export: overlapping dashed text lines (<dashes>) are all exported with duplicate number="1"

Aperta Adatta ai principianti
#35,740 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

Il bug si trova in ExportMusicXml::textLine in src/importexport/musicxml/internal/export/exportmusicxml.cpp, dove il ramo dei trattini cerca uno slot libero usando l'helper delle parentesi invece di quello dei trattini. Inizia leggendo quel ramo e come vengono usati m_dashes e m_brackets, poi importa il file in.musicxml di 2 battute dal report ed esportalo per confrontare gli attributi number. È completato quando due linee tratteggiate concorrenti vengono esportate con numeri distinti e i test esistenti dell'export MusicXML continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

community MusicXML
Issue type

Import/export issue

Description with steps to reproduce

When exporting two or more concurrent dashed text lines (<dashes>) to MusicXML, MuseScore Studio exports all of their <dashes type="start"> and <dashes type="stop"> elements with number="1" instead of distinct MusicXML number attributes (number="1", number="2", ...).

  1. Save the minimal 2-measure MusicXML below as in.musicxml (Measure 1 starts rall. with <dashes type="start" number="1"/> above the staff and smorz. with <dashes type="start" number="2"/> below the staff; Measure 2 stops both).
  2. Import and re-export to MusicXML (MuseScore4.exe -o out.musicxml in.musicxml, or open in.musicxml in MuseScore Studio and choose File > Export > MusicXML).
  3. Inspect the <dashes> elements in out.musicxml.

Actual behavior:
out.musicxml writes number="1" on every <dashes> element:

<dashes type="start" number="1"/>
<dashes type="start" number="1"/>
...
<dashes type="stop" number="1"/>
<dashes type="stop" number="1"/>

This makes overlapping vs. nested dashed text spans ambiguous to downstream MusicXML consumers.

Expected behavior:
Concurrent <dashes> spans receive distinct number attributes (number="1" and number="2"), matching how <bracket> lines are numbered.

Supporting files, videos and screenshots

Minimal reproducible in.musicxml:

<?xml version="1.0" encoding="utf-8"?>
<score-partwise version="4.0">
  <part-list>
    <score-part id="P1"><part-name>Piano</part-name></score-part>
  </part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>1</divisions>
        <key><fifths>0</fifths></key>
        <time><beats>4</beats><beat-type>4</beat-type></time>
        <clef><sign>G</sign><line>2</line></clef>
      </attributes>
      <direction placement="above">
        <direction-type><words font-style="italic">rall.</words></direction-type>
        <direction-type><dashes type="start" number="1"/></direction-type>
      </direction>
      <direction placement="below">
        <direction-type><words font-style="italic">smorz.</words></direction-type>
        <direction-type><dashes type="start" number="2"/></direction-type>
      </direction>
      <note>
        <pitch><step>C</step><octave>5</octave></pitch>
        <duration>4</duration><voice>1</voice><type>whole</type>
      </note>
    </measure>
    <measure number="2">
      <direction placement="above">
        <direction-type><dashes type="stop" number="1"/></direction-type>
      </direction>
      <direction placement="below">
        <direction-type><dashes type="stop" number="2"/></direction-type>
      </direction>
      <note>
        <pitch><step>C</step><octave>5</octave></pitch>
        <duration>4</duration><voice>1</voice><type>whole</type>
      </note>
    </measure>
  </part>
</score-partwise>
In which versions of MuseScore Studio is this issue present?

4.7.7 (4.7.7.261109195), also present in current main (08d70c1a6ae0f5553603507c32e6db5379ad75d9)

Regression

I was unable to check

Operating system

Windows 11

Additional context

Root cause in src/importexport/musicxml/internal/export/exportmusicxml.cpp (ExportMusicXml::textLine, lines 5805–5817 on 08d70c1a6ae0f5553603507c32e6db5379ad75d9):

    if (isDashes) {
        n = findDashes(tl);
        if (n >= 0) {
            m_dashes[n] = nullptr;
        } else {
            n = findBracket(nullptr); // <-- calls findBracket(nullptr) instead of findDashes(nullptr)
            if (n >= 0) {
                m_dashes[n] = tl;
            }

Because findBracket(nullptr) searches m_brackets rather than m_dashes, whenever m_brackets[0] is empty it returns 0 (number="1") for every new dashed line, overwriting m_dashes[0]. Replacing findBracket(nullptr) with findDashes(nullptr) allocates free slots in m_dashes as intended.

Checklist
  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
Lingua principale
C++
Stelle
15.5k
Fork
3.4k
Merge medio
2g 18h
PR unite (30g)
114

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di musescore/MuseScore

Tutte le issue di musescore/MuseScore

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.