Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ export class AlphaTabWorkerScoreRenderer<T> implements IScoreRenderer {
(this.renderFinished as EventEmitterOfT<RenderFinishedEventArgs>).trigger(data.result);
break;
case 'alphaTab.postRenderFinished':
this.boundsLookup = BoundsLookup.fromJson(data.boundsLookup, this._api.score!);
this.boundsLookup?.finish();
const score = this._api.score;
if (score && data.boundsLookup) {
this.boundsLookup = BoundsLookup.fromJson(data.boundsLookup, this._api.score!);
this.boundsLookup?.finish();
}
(this.postRenderFinished as EventEmitter).trigger();
break;
case 'alphaTab.error':
Expand Down
10 changes: 6 additions & 4 deletions packages/alphatab/src/rendering/LineBarRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,19 @@ export abstract class LineBarRenderer extends BarRendererBase {
s = [];
const zero = MusicFontSymbol.Tuplet0 as number;
if (num > 10) {
s.push((zero + Math.floor(num / 10)) as MusicFontSymbol);
s.push((zero + (num - 10)) as MusicFontSymbol);
const tens = Math.floor(num / 10);
s.push((zero + tens) as MusicFontSymbol);
s.push((zero + (num - 10 * tens)) as MusicFontSymbol);
} else {
s.push((zero + num) as MusicFontSymbol);
}

s.push(MusicFontSymbol.TupletColon);

if (den > 10) {
s.push((zero + Math.floor(den / 10)) as MusicFontSymbol);
s.push((zero + (den - 10)) as MusicFontSymbol);
const tens = Math.floor(den / 10);
s.push((zero + tens) as MusicFontSymbol);
s.push((zero + (den - 10 * tens)) as MusicFontSymbol);
} else {
s.push((zero + den) as MusicFontSymbol);
}
Expand Down
14 changes: 8 additions & 6 deletions packages/alphatab/src/rendering/glyphs/ScoreBeatGlyph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,14 @@ export class ScoreBeatGlyph extends BeatOnNoteGlyphBase {
const group: GlyphGroup = new GlyphGroup(0, 0);
group.renderer = this.renderer;
for (const note of this.container.beat.notes) {
const g = this._createBeatDot(sr.getNoteSteps(note), group);
g.colorOverride = ElementStyleHelper.noteColor(
sr.resources,
NoteSubElement.StandardNotationEffects,
note
);
if (note.isVisible) {
const g = this._createBeatDot(sr.getNoteSteps(note), group);
g.colorOverride = ElementStyleHelper.noteColor(
sr.resources,
NoteSubElement.StandardNotationEffects,
note
);
}
}
this.addEffect(group);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1">
<part-list>
<score-part id="P1">
<part-name>Piano</part-name>
<score-instrument id="P1-I1">
<instrument-name>Piano</instrument-name>
</score-instrument>
<midi-device id="P1-I1" port="1"></midi-device>
<midi-instrument id="P1-I1">
<midi-channel>1</midi-channel>
<midi-program>1</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1" width="412.51">
<attributes>
<divisions>480</divisions>
<key>
<fifths>-5</fifths>
</key>
<time>
<beats>9</beats>
<beat-type>8</beat-type>
</time>
<staves>2</staves>
<clef number="1">
<sign>G</sign>
<line>2</line>
</clef>
<clef number="2">
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note default-x="176.69" default-y="-142.96" print-object="no">
<pitch>
<step>F</step>
<octave>4</octave>
</pitch>
<duration>480</duration>
<tie type="start"/>
<voice>5</voice>
<type>quarter</type>
<dot/>
<stem>none</stem>
<staff>2</staff>
<notations>
<tied type="start"/>
</notations>
</note>
<note default-x="255.99" default-y="-142.96">
<pitch>
<step>F</step>
<octave>4</octave>
</pitch>
<duration>1440</duration>
<tie type="stop"/>
<voice>5</voice>
<type>half</type>
<dot/>
<stem>up</stem>
<staff>2</staff>
<notations>
<tied type="stop"/>
</notations>
</note>
</measure>
</part>
</score-partwise>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions packages/alphatab/test/exporter/AlphaTexExporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ describe('AlphaTexExporterTest', () => {
}
}

async function testRoundTripFolderEqual(name: string): Promise<void> {
async function testRoundTripFolderEqual(name: string, ignoredFiles?: string[]): Promise<void> {
const files: string[] = await TestPlatform.listDirectory(`test-data/${name}`);
const ignoredFilesLookup = new Set<string>(ignoredFiles);
for (const file of files.filter(f => !f.endsWith('.png'))) {
await testRoundTripEqual(`${name}/${file}`, null);
if (!ignoredFilesLookup.has(file) && !file.endsWith('.png')) {
await testRoundTripEqual(`${name}/${file}`, null);
}
}
}

Expand Down Expand Up @@ -133,7 +136,7 @@ describe('AlphaTexExporterTest', () => {
});

it('visual-effects-and-annotations', async () => {
await testRoundTripFolderEqual('visual-tests/effects-and-annotations');
await testRoundTripFolderEqual('visual-tests/effects-and-annotations', ['hidden-dots.mxml']);
});

it('visual-general', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/alphatab/test/exporter/Gp7Exporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Gp7ExporterTest', () => {
});

it('visual-effects-and-annotations', async () => {
await testRoundTripFolderEqual('visual-tests/effects-and-annotations');
await testRoundTripFolderEqual('visual-tests/effects-and-annotations', ['hidden-dots.mxml']);
});

it('visual-general', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ describe('EffectsAndAnnotationsTests', () => {
await VisualTestHelper.runVisualTest('effects-and-annotations/tuplets.gp');
});

it('tuplets-huge', async () => {
await VisualTestHelper.runVisualTestTex(
'C4 {tu 12 27} * 12',
'test-data/visual-tests/effects-and-annotations/tuplets-huge.png'
);
});

it('hidden-dots', async () => {
await VisualTestHelper.runVisualTest('effects-and-annotations/hidden-dots.mxml');
});

it('tuplets-advanced', async () => {
await VisualTestHelper.runVisualTest('effects-and-annotations/tuplets-advanced.gp', undefined, o => {
o.tracks = [0, 1, 2];
Expand Down
Loading