diff --git a/packages/alphatab/src/exporter/GpifWriter.ts b/packages/alphatab/src/exporter/GpifWriter.ts index 39d33d6ef..003a8c29f 100644 --- a/packages/alphatab/src/exporter/GpifWriter.ts +++ b/packages/alphatab/src/exporter/GpifWriter.ts @@ -968,13 +968,12 @@ export class GpifWriter { scoreNode.addElement('PageHeader').setCData(''); scoreNode.addElement('PageFooter').setCData(''); - scoreNode.addElement('ScoreSystemsDefaultLayout').setCData(score.defaultSystemsLayout.toString()); - scoreNode.addElement('ScoreSystemsLayout').setCData(score.systemsLayout.join(' ')); + scoreNode.addElement('ScoreSystemsDefaultLayout').innerText = score.defaultSystemsLayout.toString(); + scoreNode.addElement('ScoreSystemsLayout').innerText = score.systemsLayout.join(' '); scoreNode.addElement('ScoreZoomPolicy').innerText = 'Value'; scoreNode.addElement('ScoreZoom').innerText = '1'; - // not fully clear at this point so we rather activate it - scoreNode.addElement('MultiVoice').innerText = '1>'; + scoreNode.addElement('MultiVoice').innerText = '0'; } private _writeMasterTrackNode(parent: XmlNode, score: Score) { diff --git a/packages/alphatab/test/exporter/Gp7Exporter.test.ts b/packages/alphatab/test/exporter/Gp7Exporter.test.ts index 271e705d3..2623735f2 100644 --- a/packages/alphatab/test/exporter/Gp7Exporter.test.ts +++ b/packages/alphatab/test/exporter/Gp7Exporter.test.ts @@ -40,6 +40,13 @@ describe('Gp7ExporterTest', () => { return new Gp7Exporter().export(score, null); } + function readExportedGpif(buffer: Uint8Array): string { + const settings = new Settings(); + const zip = new ZipReader(ByteBuffer.fromBuffer(buffer), settings.importer.maxDecodingBufferSize).read(); + const gpifData = zip.find(e => e.fileName === 'score.gpif')!.data; + return IOHelper.toString(gpifData, settings.importer.encoding); + } + async function testRoundTripEqual(name: string, ignoreKeys: string[] | null): Promise { const expected = await loadScore(name); if (!expected) { @@ -150,6 +157,31 @@ describe('Gp7ExporterTest', () => { ComparisonHelpers.expectJsonEqual(expectedJson, actualJson, '', ['accidentalmode']); }); + it('alphatex-to-gp7-score-metadata', () => { + const tex = `\\title "Multitrack Metadata" + \\artist "alphaTab" + \\tempo 90 + . + \\track "Piano" + \\instrument acousticgrandpiano + C4.4 D4.4 E4.4 F4.4 + . + \\track "Guitar" + \\instrument acousticguitarsteel + 0.3.4 2.3.4 3.3.4 5.3.4 + `; + + const score = ScoreLoader.loadAlphaTex(tex); + const gpif = readExportedGpif(exportGp7(score)); + + expect(gpif).toContain('3'); + expect(gpif).toContain(''); + expect(gpif).not.toContain('0'); + expect(gpif).not.toContain('1>'); + }); + it('alphatex-drums-to-gp7', () => { const tex = `\\track "Drums" \\instrument percussion