Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/alphatab/src/exporter/GpifWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
32 changes: 32 additions & 0 deletions packages/alphatab/test/exporter/Gp7Exporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const expected = await loadScore(name);
if (!expected) {
Expand Down Expand Up @@ -150,6 +157,31 @@ describe('Gp7ExporterTest', () => {
ComparisonHelpers.expectJsonEqual(expectedJson, actualJson, '<alphatex>', ['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('<ScoreSystemsDefaultLayout>3</ScoreSystemsDefaultLayout>');
expect(gpif).toContain('<ScoreSystemsLayout>');
expect(gpif).not.toContain('<ScoreSystemsDefaultLayout><![CDATA[');
expect(gpif).not.toContain('<ScoreSystemsLayout><![CDATA[');
expect(gpif).toContain('<MultiVoice>0</MultiVoice>');
expect(gpif).not.toContain('<MultiVoice>1></MultiVoice>');
});

it('alphatex-drums-to-gp7', () => {
const tex = `\\track "Drums"
\\instrument percussion
Expand Down