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
4 changes: 3 additions & 1 deletion packages/alphatab/src/rendering/effects/CapoEffectInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 5 additions & 5 deletions packages/alphatab/src/rendering/effects/TripletFeelEffectInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
Loading