Skip to content

Commit 40e9d6d

Browse files
committed
fix(various): small fixes
remove the rest begining. and change 6 lines 8th notes splitted to 2+2+2
1 parent bb93555 commit 40e9d6d

3 files changed

Lines changed: 5 additions & 40 deletions

File tree

internal/lyric/lyric.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type Lyric interface {
2727
CalculateHypen(ctx context.Context, prevLyric, currentLyric *LyricPosition) (location []entity.Coordinate)
2828
RenderHypen(ctx context.Context, canv canvas.Canvas, measure []*entity.NoteRenderer)
2929
CalculateMarginLeft(txt string) float64
30-
CalculateWholeLyricGroupLength(lyrics []entity.Lyric) float64
3130
}
3231

3332
type lyricInteractor struct{}
@@ -141,19 +140,3 @@ func (li *lyricInteractor) CalculateMarginLeft(txt string) float64 {
141140
}
142141
return 0
143142
}
144-
145-
func (li *lyricInteractor) CalculateWholeLyricGroupLength(lyrics []entity.Lyric) float64 {
146-
max := float64(0)
147-
for _, l := range lyrics {
148-
wholeWord := ""
149-
for _, t := range l.Text {
150-
wholeWord += t.Value
151-
}
152-
lyricWidth := li.CalculateLyricWidth(wholeWord)
153-
if lyricWidth > max {
154-
max = lyricWidth
155-
}
156-
}
157-
158-
return max
159-
}

internal/rhythm/lines.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,6 @@ func cleanBeamByNumber(ctx context.Context, notes []*entity.NoteRenderer, beamNu
431431
// FIXME: skip this process entirely and follow 1 to 1 as in the musicxml file when it is 4 beat type
432432
func splitBeam(ctx context.Context, notes []*entity.NoteRenderer, segments map[int][]beamSplitMarker) []*entity.NoteRenderer {
433433

434-
measure, _ := ctx.Value(constant.CtxKeyMeasureNum).(int)
435-
436-
_ = measure
437434
if len(segments[1]) == 0 && len(segments[2]) == 0 {
438435
return notes
439436
}
@@ -448,9 +445,11 @@ func splitBeam(ctx context.Context, notes []*entity.NoteRenderer, segments map[i
448445
case 5: // split 3 x 2
449446
notes[segment.StartIndex+2].UpdateBeam(1, musicxml.NoteBeamTypeEnd)
450447
notes[segment.StartIndex+3].UpdateBeam(1, musicxml.NoteBeamTypeBegin)
451-
case 6: // spilt 3 x 3
452-
notes[segment.StartIndex+2].UpdateBeam(1, musicxml.NoteBeamTypeEnd)
453-
notes[segment.StartIndex+3].UpdateBeam(1, musicxml.NoteBeamTypeBegin)
448+
case 6: // spilt 2 x 2 x 2 (what if 6/8 timesig?)
449+
notes[segment.StartIndex+1].UpdateBeam(1, musicxml.NoteBeamTypeEnd)
450+
notes[segment.StartIndex+2].UpdateBeam(1, musicxml.NoteBeamTypeBegin)
451+
notes[segment.StartIndex+3].UpdateBeam(1, musicxml.NoteBeamTypeEnd)
452+
notes[segment.StartIndex+4].UpdateBeam(1, musicxml.NoteBeamTypeBegin)
454453
}
455454
}
456455

internal/staff/staff.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func NewStaff() Staff {
4444
}
4545

4646
func (si *staffInteractor) RenderStaff(ctx context.Context, canv canvas.Canvas, x, y int, keySignature keysig.KeySignature, timeSignature timesig.TimeSignature, measures []musicxml.Measure, prevNotes ...*entity.NoteRenderer) (staffInfo StaffInfo) {
47-
restBeginning := false
4847

4948
staffInfo.NextLineRenderer = []*entity.NoteRenderer{}
5049

@@ -73,22 +72,6 @@ func (si *staffInteractor) RenderStaff(ctx context.Context, canv canvas.Canvas,
7372
}
7473
for notePos, note := range measure.Notes {
7574

76-
// FIXME: use the hidden attributes on the musicxml files instead of forcing hide every beginnning rest
77-
// don't print anything when rest on the beginning on the music
78-
if note.Rest != nil && measure.Number == 1 {
79-
80-
if notePos == 0 {
81-
restBeginning = true
82-
continue
83-
}
84-
85-
if restBeginning {
86-
continue
87-
}
88-
}
89-
90-
restBeginning = false
91-
9275
n, octave, strikethrough := moveabledo.GetNumberedNotation(keySignature, note)
9376
noteLength := timeSignature.GetNoteLength(rctx, measure.Number, note)
9477

0 commit comments

Comments
 (0)