diff --git a/packages/alphatab/src/rendering/effects/CapoEffectInfo.ts b/packages/alphatab/src/rendering/effects/CapoEffectInfo.ts index 1882d4eca..d55d1936a 100644 --- a/packages/alphatab/src/rendering/effects/CapoEffectInfo.ts +++ b/packages/alphatab/src/rendering/effects/CapoEffectInfo.ts @@ -16,7 +16,9 @@ export const capoEffectInfo: EffectInfo = { hideOnMultiTrack: false, sizingMode: EffectBarGlyphSizing.SingleOnBeat, shouldCreateGlyph: (_renderer: BarRendererBase, beat: Beat): boolean => { - return beat.index === 0 && beat.voice.bar.index === 0 && beat.voice.bar.staff.capo !== 0; + return ( + beat.voice.index === 0 && beat.index === 0 && beat.voice.bar.index === 0 && beat.voice.bar.staff.capo !== 0 + ); }, createNewGlyph: (renderer: BarRendererBase, beat: Beat): EffectGlyph => { return new TextGlyph( diff --git a/packages/alphatab/src/rendering/effects/TripletFeelEffectInfo.ts b/packages/alphatab/src/rendering/effects/TripletFeelEffectInfo.ts index 45dd6ace1..b25a00727 100644 --- a/packages/alphatab/src/rendering/effects/TripletFeelEffectInfo.ts +++ b/packages/alphatab/src/rendering/effects/TripletFeelEffectInfo.ts @@ -16,12 +16,12 @@ export const tripletFeelEffectInfo: EffectInfo = { hideOnMultiTrack: true, sizingMode: EffectBarGlyphSizing.SinglePreBeat, shouldCreateGlyph: (_renderer: BarRendererBase, beat: Beat): boolean => { + const masterBar = beat.voice.bar.masterBar; + const isFirstBeat = beat.voice.bar.staff.index === 0 && beat.voice.index === 0 && beat.index === 0; return ( - beat.index === 0 && - ((beat.voice.bar.masterBar.index === 0 && - beat.voice.bar.masterBar.tripletFeel !== TripletFeel.NoTripletFeel) || - (beat.voice.bar.masterBar.index > 0 && - beat.voice.bar.masterBar.tripletFeel !== beat.voice.bar.masterBar.previousMasterBar!.tripletFeel)) + isFirstBeat && + ((masterBar.index === 0 && masterBar.tripletFeel !== TripletFeel.NoTripletFeel) || + (masterBar.index > 0 && masterBar.tripletFeel !== masterBar.previousMasterBar!.tripletFeel)) ); }, createNewGlyph: (_renderer: BarRendererBase, beat: Beat): EffectGlyph => { diff --git a/packages/alphatab/test-data/visual-tests/effects-and-annotations/triplet-feel-and-capo-multi-voice.png b/packages/alphatab/test-data/visual-tests/effects-and-annotations/triplet-feel-and-capo-multi-voice.png new file mode 100644 index 000000000..3f95b8a6b Binary files /dev/null and b/packages/alphatab/test-data/visual-tests/effects-and-annotations/triplet-feel-and-capo-multi-voice.png differ diff --git a/packages/alphatab/test/visualTests/features/EffectsAndAnnotations.test.ts b/packages/alphatab/test/visualTests/features/EffectsAndAnnotations.test.ts index 334401aa8..228f1bec4 100644 --- a/packages/alphatab/test/visualTests/features/EffectsAndAnnotations.test.ts +++ b/packages/alphatab/test/visualTests/features/EffectsAndAnnotations.test.ts @@ -145,6 +145,26 @@ describe('EffectsAndAnnotationsTests', () => { await VisualTestHelper.runVisualTest('effects-and-annotations/triplet-feel.gp'); }); + it('triplet-feel-and-capo-multi-voice', async () => { + await VisualTestHelper.runVisualTestTex( + ` + \\track "Piano" + \\staff {score} + \\capo 2 + \\tf t8 + \\voice + :8 c5 d5 e5 f5 g5 a5 b5 c6 | \\tf t16 c5 d5 e5 f5 g5 a5 b5 c6 + \\voice + :2 c4 c4 | c4 c4 + \\staff {score} + \\capo 5 + \\clef F4 + :8 c3 d3 e3 f3 g3 a3 b3 c4 | c3 d3 e3 f3 g3 a3 b3 c4 + `, + 'test-data/visual-tests/effects-and-annotations/triplet-feel-and-capo-multi-voice.png' + ); + }); + it('free-time', async () => { await VisualTestHelper.runVisualTest('effects-and-annotations/free-time.gp'); });