Skip to content

Commit 6aaec2e

Browse files
authored
fix(gp): check harmonic type case insensitive (#2648)
1 parent 03efb03 commit 6aaec2e

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

packages/alphatab/src/importer/GpifParser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,26 +2393,26 @@ export class GpifParser {
23932393
case 'HarmonicType':
23942394
const htype = c.findChildElement('HType');
23952395
if (htype) {
2396-
switch (htype.innerText) {
2397-
case 'NoHarmonic':
2396+
switch (htype.innerText.toLowerCase()) {
2397+
case 'noharmonic':
23982398
note.harmonicType = HarmonicType.None;
23992399
break;
2400-
case 'Natural':
2400+
case 'natural':
24012401
note.harmonicType = HarmonicType.Natural;
24022402
break;
2403-
case 'Artificial':
2403+
case 'artificial':
24042404
note.harmonicType = HarmonicType.Artificial;
24052405
break;
2406-
case 'Pinch':
2406+
case 'pinch':
24072407
note.harmonicType = HarmonicType.Pinch;
24082408
break;
2409-
case 'Tap':
2409+
case 'tap':
24102410
note.harmonicType = HarmonicType.Tap;
24112411
break;
2412-
case 'Semi':
2412+
case 'semi':
24132413
note.harmonicType = HarmonicType.Semi;
24142414
break;
2415-
case 'Feedback':
2415+
case 'feedback':
24162416
note.harmonicType = HarmonicType.Feedback;
24172417
break;
24182418
}
12.4 KB
Binary file not shown.

packages/alphatab/test/importer/Gp8Importer.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,4 +504,10 @@ describe('Gp8ImporterTest', () => {
504504
expect(score.masterBars[5].beamingRules!.groups.has(Duration.Eighth)).to.be.true;
505505
expect(score.masterBars[5].beamingRules!.groups.get(Duration.Eighth)!.join(',')).to.be.equal('4,4');
506506
});
507+
508+
it('harmonics-lowercase', async () => {
509+
const reader = await prepareImporterWithFile('guitarpro8/harmonics-lowercase.gp');
510+
const score = reader.readScore();
511+
GpImporterTestHelper.checkHarmonics(score);
512+
});
507513
});

0 commit comments

Comments
 (0)