From 764e743ed00c9e1ae7d95592f5bc4297d496d738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20K=C3=B6nig=20de=20Oliveira?= Date: Mon, 13 Apr 2026 21:45:40 +0000 Subject: [PATCH] fix(musicxml): correct barre fret export for shifted chord diagrams Barre notes written via the 'unwritten barres' fallback path in writeMusicXml(FretDiagram) were emitting relative fret numbers instead of absolute ones, while every other code path (dots, first-fret tag) correctly applied fretOffset. This caused any chord diagram with first-fret > 1 to render the barre at the wrong position in importing applications. Fix: add item->fretOffset() to the fret value in both the bStarts and bEnds loops, consistent with how dot frets are already handled. Example: a Csus4 barre at position 3 (fretOffset=2) was exporting fret=1 instead of the correct fret=3. Fixes: barre chords in all shifted chord diagrams (first-fret > 1) --- src/importexport/musicxml/internal/export/exportmusicxml.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/importexport/musicxml/internal/export/exportmusicxml.cpp b/src/importexport/musicxml/internal/export/exportmusicxml.cpp index e64b3b9b4ce1a..6eb86fe3a0265 100644 --- a/src/importexport/musicxml/internal/export/exportmusicxml.cpp +++ b/src/importexport/musicxml/internal/export/exportmusicxml.cpp @@ -8929,7 +8929,7 @@ static void writeMusicXml(const FretDiagram* item, XmlWriter& xml) for (int j : bStarts) { xml.startElement("frame-note"); xml.tag("string", mxmlString); - xml.tag("fret", j); + xml.tag("fret", j + item->fretOffset()); xml.tag("barre", { { "type", "start" } }); xml.endElement(); } @@ -8937,7 +8937,7 @@ static void writeMusicXml(const FretDiagram* item, XmlWriter& xml) for (int j : bEnds) { xml.startElement("frame-note"); xml.tag("string", mxmlString); - xml.tag("fret", j); + xml.tag("fret", j + item->fretOffset()); xml.tag("barre", { { "type", "stop" } }); xml.endElement(); }